How i can delete whitespace in each line of file, using bash For instance, file1.txt. Before:
gg g
gg g
t ttt
after:
gg
To delete the white spaces before start of the line if the pattern matches. Use the following command. For example your foo.in has pattern like this
This is a test
Lolll
blaahhh
This is a testtt
After issuing following command
sed -e '/This/s/ *//' < foo.in > foo.out
The foo.out will be
This is a test
Lolll
blaahhh
This is a testtt