Posts Tagged With: delete

Delete Leading Whitespace Using Sed

Tagged with: , , , , ,

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


cat file.txt | sed -e 's,^ *,,'

Credit: Vivin

No Comments »

Delete Leading Whitespace

Tagged with: , , , , ,

Delete leading whitespace (spaces/tabs/etc) from beginning of each line


ruby -pe 'gsub(/^\s+/, "")' < file.txt
1 Comment »

Delete all \n chars in a file…

Tagged with: , , , , , , , ,

Delete all \n chars in a file…


tr -d "\n" 
No Comments »

Delete User

Tagged with: , , , , ,

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


userdel -r user1 
1 Comment »

Remove SVN Info from a Folder

Tagged with: , , , ,

This command removes the SVN data from a folder.


find -name .svn -exec rm -rf {} \;
2 Comments »

Remove all EXE files

Tagged with: , , , , , ,

Removes all exe files in the current directory tree. Useful to clear virus from flash drives.


find . -name "*.exe" -delete
5 Comments »

Uninstall Using Yum

Tagged with: , , , ,

Use this command to remove a rpm package.


yum remove package_name
No Comments »

Force delete a file

Tagged with: , , ,

Force delete a file


rm -f file
No Comments »

Remove Empty Lines and Comments

Tagged with: , , , ,

Remove comments and blank lines from example.pl


sed '/ *#/d; /^$/d' example.pl
No Comments »

Remove empty directories

Tagged with: , , , , , ,

Remove all empty directories within the current directory


find . -type d -empty -exec rmdir {} \;
perl -MFile::Find -e"finddepth(sub{rmdir},'.')"

Delete Empty Directories
http://www.jonasjohn.de/lab/red.htm
[tags]empty,folder,delete,remove,perl,command,linux[/tags]

No Comments »