Tuesday, 10 September 2013

Sed or Awk,gwak to remove numbers in a file

Sed or Awk,gwak to remove numbers in a file

I have file like this:
pup@pup:~/perl_test$ cat numbers
1234567891
2133123131
4324234243
4356257472
3465645768000
3424242423
3543676586
3564578765
6585645646000
0001212122
1212121122
0003232322
In the above file i want remove trailing zero's and prefix zeros's so the
output will be like this
pup@pup:~/perl_test$ cat numbers
1234567891
2133123131
4324234243
4356257472
3465645768
3424242423
3543676586
3564578765
6585645646
1212122
1212121122
3232322
How to achieve this? I tried sed to remove those zero's. It was easy to
remove the trailing zero's but not the prefix zero's.
Help me.

No comments:

Post a Comment