Advertisement
Guest User

Untitled

a guest
Oct 2nd, 2014
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. foo()
  2. {
  3. }
  4.  
  5. buz()
  6. {
  7. }
  8.  
  9. BEGIN {
  10. RS = "nn+";
  11. FS = "n";
  12. }
  13. /[a-z]+()n/ {print "FUNCTION: " $1;}
  14. {print "NOT FOUND: " $0;}
  15.  
  16. NOT FOUND: foo()
  17. {
  18. }
  19. NOT FOUND: buz()
  20. {
  21. }
  22.  
  23. BEGIN {
  24. RS = "";
  25. FS = "n";
  26. }
  27. /[a-z]+()/ {print "FUNCTION: " $1;}
  28. !/[a-z]+()/ {print "NOT FOUND: " $0;}
  29.  
  30. awk -v RS='nn+' -v FS='n' '
  31. $1 ~ /^[a-z]+()$/ {print "FUNCTION: " $1; next}
  32. {print "NOT FOUND: " $0}
  33. ' text.txt
  34.  
  35. FUNCTION: foo()
  36. FUNCTION: buz()
  37.  
  38. awk '{if(/^[a-z]+()n/)print "FUNCTION:"$1; else print "NOT FOUND: "$0}' RS="" file
  39.  
  40. foo() { }
  41. buz() { }
  42.  
  43. awk '{$1=$1; print} ' RS='nn' FS='n' OFS=" "
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement