Issue
I have file(list6.txt) which looks like:
xxxxxxx xxxxxxxxx;
xxxxxx xxxxx PxxxxxxxxFxxxxxx xxxxxxx PxxxxxxxxFxxxxxx {
@Oxxxxxxx
xxxxxx Sxxxxx xxxNxxx() {
xxxxxx "Pxxxx_Pxxxxxxxx";
}
@Oxxxxxxx
xxxxxx Pxxxxxxxx xxxxxxPxxxxxxxx(Cxxxxxx xxx) {
xxxxxx xxx Pxxxxxxxx(xxx);
}
}
I am trying to remove all leading spaces with command:
cat list6.txt | sed 's/^[ \t]//'
OR
sed 's/^[ \t]*//' list6.txt
However i cant do it with above 2 commands.
Could someone help me with it.
Thanks
Solution
Use this more portable sed:
sed -i.bak 's/^[[:space:]]*//' file
This works with both gnu-sed and BSD sed as well.
Answered By - anubhava Answer Checked By - Marilyn (WPSolving Volunteer)