utilities

hi experts,

i have a file

sample:

000123 5 7 0008
00345 5 9 0004

how can i get an output as

123 5 7 8
345 5 9 4

thanks in an advance
subhendu

sed 's/0//g' filename

where filename is your input data

sed -e 's/^0*//' -e 's/\(\s\)0*/\1/g' sample

hello,

i have tried your code and it is giving output as

123 5 7 0008
45 5 9 0004

but i required the output as:

123 5 7 8
45 5 9 4

What version of sed are you using. I've got it working with both GNU sed 4.1.5 and sed on HP-UX 11.3.

Hi Pludi,

Can you please help me out to solve the prob.

I have a file

sample:

000123 5.03 7.05 0008
00345 1005 5 9 0004

how can i get an output as

123 5.03 7.05 8
345 1005 9 4

Thanks in advance
Subhendu