View Single Post

  #7 (permalink)  
Old 04-08-2008
Ralf Fassel
 
Posts: n/a
Default Re: reverse effect of uniq -c

* A <born.to.b.wyld@gmail.com>
| > awk '{ n = $1; $1 = "" ; sub("^ +",""); while ( n-- ) print }' test.txt
| Thanks. Those suggestions help.

Just for the record: note that changing $1 might have an impact on the
rest of the line if the other fields are separated by more than one
space:

echo "1 2 4 5 6" | awk '{$1 = ""; print}'
=> 2 4 5 6
and not " 2 4 5 6" as one might expect.

YMMV
R'
Reply With Quote