View Single Post
id10t id10t is online now
Registered
 
id10t's Avatar
 
Join Date: Mar 2003
Posts: 10,459
Quote:
Originally Posted by widebody911 View Post
cat file | sed -e s/^0*//g > file.new
you could use the -i arg to sed and not have to cat it or redirect to a new file

sed -i s/^0*//g filename

Or you could use expr and add the numbers to 0, which will drop all insignificant digits

for i in `cat file`
do
expr $i + 0 >> newfile
done


Although thats kinda sloppy... but depending on how the file is structured, may be required.
__________________
“IN MY EXPERIENCE, SUSAN, WITHIN THEIR HEADS TOO MANY HUMANS SPEND A LOT OF TIME IN THE MIDDLE OF WARS THAT HAPPENED CENTURIES AGO.”
Old 08-10-2008, 05:39 AM
  Pelican Parts Catalog | Tech Articles | Promos & Specials    Reply With Quote #5 (permalink)