Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

printf demo

By: a guest on Oct 19th, 2012  |  syntax: None  |  size: 0.34 KB  |  views: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. bash-4.2$ echo 'Station Name
  2. Station Code
  3. A N %s DEV NAGAR
  4. ACND
  5. ABHAIPUR
  6. AHA
  7. ABOHAR
  8. ABS
  9. ABU ROAD
  10. ABR' | awk 'NR%2==1 {printf $0","} NR%2==0 { print $0}'
  11. Station Name,Station Code
  12. awk: cmd. line:1: (FILENAME=- FNR=3) fatal: not enough arguments to satisfy format string
  13.         `A N %s DEV NAGAR,'
  14.              ^ ran out for this one