silly_xp_user

Joined: Sat Oct 22, 2005 4:55 pm Posts: 11
|
Posted: Sat May 22, 2010 6:56 pm Post subject: quick awk-to-sed question |
|
|
Hello, can someone please assist.
I would like to know how the following might be done in sed.
I have read sed1liners and various other sed faqs but cannot quite work this one out.
Thanks for any constructive help given.
Hal
| Code: | #!/bin/bash
#Align second field of each line offset 15.
#How would you do this with sed?
cat << EOF | awk '{ printf "%-15s ",$1; for(i=2;i<=NF;i++) printf "%s ",$i ; print ""}'
1 one
10 ten
300 three hundred
1000 one thousand
90042 ninety thousand and forty two
EOF
#- gives this output without the hashes (#).
#1 one
#10 ten
#300 three hundred
#1000 one thousand
#90042 ninety thousand and forty two
|
|
|