Tag: delete

Delete Leading Whitespace Using Sed

Delete leading whitespace (spaces/tabs/etc) from beginning of each line. Same as yesterday’s command – but using sed cat file.txt |…

Delete Leading Whitespace

Delete leading whitespace (spaces/tabs/etc) from beginning of each line ruby -pe ‘gsub(/^\s+/, “”)’ < file.txt

Delete all \n chars in a file…

Delete all \n chars in a file… tr -d “\n”

Delete User

Delete a user ( ‘-r’ eliminates home directory) userdel -r user1

Remove SVN Info from a Folder

This command removes the SVN data from a folder. find -name .svn -exec rm -rf {} \;

Remove all EXE files

Removes all exe files in the current directory tree. Useful to clear virus from flash drives. find . -name “*.exe”…

Uninstall Using Yum

Use this command to remove a rpm package. yum remove package_name

Force delete a file

Force delete a file rm -f file

Remove Empty Lines and Comments

Remove comments and blank lines from example.pl sed ‘/ *#/d; /^$/d’ example.pl

Remove empty directories

Remove all empty directories within the current directory find . -type d -empty -exec rmdir {} \; perl -MFile::Find -e”finddepth(sub{rmdir},’.’)”…