Saturday 16 June 2012

Remove a space in front of word or words in a file

How to remove space in front of a word in a file?



Just use this command to remove the space in front.

cat filename |cut -d":" -f2 |sort | sed -e 's/^[ \t]*//'

Now it will show you the output. If you want the output added inside a file just use this 

 cat filename |cut -d":" -f2 |sort | sed -e 's/^[ \t]*//' > filename.txt

1 comment:

Unknown said...

Quite illustrative post and this is useful for Remove a space in front of word or words in a file.