awk (more?)
- Put code you want to run before or after inside BEGIN and END blocks.
- Example: count number of occurrences in file:
$ awk 'BEGIN {print "Analysis:" }
/foo/{++foobar }
END {print "foo appears
" foobar " times." }' file
/foo/{++foobar }
END {print "foo appears
" foobar " times." }' file
0 comments:
Post a Comment