Some links:
Remove duplicate lines with uniq
A user's guide for GNU AWK
AWK one-liners
AWK can process each line of a file and gives relevant output.
One problem is to find the number of occurrences of a word in a file. It's easy to output the lines that contain such a word, or count the number of such lines. But if a line contains multiple occurrences of a word, the solution is not so easy. One solution is to use the "tr" command to break the fields in a line to one word each line, and then employ common approach.
grep can be used to find a word in files. The following recursively find in current directory and sub-directories for files that contain "word":
grep -R "word" *
Tuesday, March 30, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment