Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/awk -f
- # Tema d'esame 07/11/2005 A (www.labinf.polito.it/whitone/index.php?summ=SO)
- # Uso: awk -f scommenta.awk sorgente.txt
- # 15/08/2012 - BNCRCR
- BEGIN {
- dentro = 0;
- }
- # Pattern che identifica una riga che comincia con /*
- /^\/\*/ {
- dentro = 1
- }
- # Pattern che identifica una riga che finisce con */
- /\*\/$/ {
- dentro = 0
- }
- # Pattern che identifica una riga che non comincia con // o */
- # (quelle che iniziano con /* sono già scartate da dentro = 1)
- # (espressione regolare un po' spartana)
- /^[^\/\/]/ && /^[^\*\/]/ {
- if (!dentro)
- print $0 >> "output.tmp"
- }
- END {
- comando = "cat output.tmp > " FILENAME
- system(comando)
- system("rm -f output.tmp")
- }
Advertisement
Add Comment
Please, Sign In to add comment