Input file:
$ cat thres.txt
0002345
01234
0901234
0000034
14
000923
Required: Remove the leading zero's with blanks from the above file.
The sed solution:
$ sed -e 's/^0/ /;: loop' -e 's/ 0/ /;t loop' thres.txt
Output:
2345
1234
901234
34
14
923
"Where there is a shell, there is a WAY !!" Blog on Awk, Sed, BASH ones liners and scripts.
$ sed -e 's/^0/ /;: loop' -e 's/ 0/ /;t loop' thres.txt
2345
1234
901234
34
14
923
© Jadu Saikia www.UNIXCL.com
2 comments:
Hi,
I invite you and your readers to contentxn.com.
Registering for an exclusive contentxn publisher account only takes a minute of your time to register click the link below
http://www.contentxn.com/contentxn/pub_register.php
We look forward to working with you.
Cheers,
www.contentxn.com
It helped! thanks!
Post a Comment