Showing posts with label grep. Show all posts
Showing posts with label grep. Show all posts

Tuesday, August 24, 2010

Find with grep displaying line number & filename

( find . -exec grep -H -n 'blahblahpattern' {} \; )

Tuesday, August 4, 2009

Using Grep to return only the match, getting unique/distinct results, and sorting

Display only the matches (in this case, occurrences of 6 numbers in a row)

grep -o "[0-9]\{6\}" test.txt

Removing repeated results, and sorting

grep -o "[0-9]\{6\}" test.txt | uniq | sort

Woo.