About format file

Hi all,

There's a file:
000
001
010
100

If I want to format this file to
0
1
10
100

If this file is very big, how to shorten the process time?
THANKS.

Try like...

 sed 's/^[0]*//' test.txt

---------- Post updated at 05:36 AM ---------- Previous update was at 05:33 AM ----------

Sorry for the confusion..

 awk '{printf "%d\n",$0}' test.txt 
1 Like

Works.
That's cool.
Appreciate it.

alternatively:

awk '{$1+=0}1' infile
awk '{print $1+0}' infile

See what is fastest..

This will probably not be fast enough:

sed 's/^0*\(.*[0-9]\)/\1/' infile