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 | sed -e 's,^ *,,'
Credit: Vivin
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
Delete leading whitespace (spaces/tabs/etc) from beginning of each line
ruby -pe 'gsub(/^\s+/, "")' < file.txt
Delete all \n chars in a file…
tr -d "\n"
Delete a user ( ‘-r’ eliminates home directory)
userdel -r user1
This command removes the SVN data from a folder.
find -name .svn -exec rm -rf {} \;
Removes all exe files in the current directory tree. Useful to clear virus from flash drives.
find . -name "*.exe" -delete
Use this command to remove a rpm package.
yum remove package_name
Force delete a file
rm -f file
Remove comments and blank lines from example.pl
sed '/ *#/d; /^$/d' example.pl
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]