riccardinofuffolo

Sistemi Operativi - 07/07/2005 - Es. 6

Aug 15th, 2012
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Awk 0.67 KB | None | 0 0
  1. #!/bin/awk -f
  2. # Tema d'esame 07/07/2005 (www.labinf.polito.it/whitone/index.php?summ=SO)
  3. # Uso: awk -f uppertwelve.awk parole.txt
  4. # 15/08/2012 - BNCRCR
  5.  
  6. # Cose da fare per ogni riga
  7. {
  8.     for (i = 1; i <= NF; i++) {
  9.         if (length($i) > 12)
  10.             $i = toupper($i)
  11.         printf("%s ", $i) >> "output.tmp"
  12.     }  
  13.     printf("\n") >> "output.tmp"
  14. }
  15.  
  16. END {
  17. # Eseguito solo quando leggo EOF nel file di input
  18.     comando = "cat output.tmp > " FILENAME
  19.     system(comando)
  20.     system("rm -f output.tmp")
  21. }
  22.  
  23. # == parole.txt ==
  24. # ciao sono un file di testo con alcune parole lunghe, tipo pedissequamente
  25. # per non parlare poi di informalmente
  26. # e avete sentito poi il vicepresidente?
  27. # vabbè.
Advertisement
Add Comment
Please, Sign In to add comment