how to search for a SSN using bash
This quick snippet will help you grep a file for a Social Security Number.
Posted by: koloa on August 25 2008 | Category: programming | Comments: 0 |
Snippet
$ grep '[0-9]\{3\}-\{0,1\}[0-9]\{2\}-\{0,1\}[0-9]\{4\}' name_of_file
Snippet Explanation for Bash
The first grouping states match any digit 3 times.
the next set says match the ‘-’ symbol zero or one time
-\{0,1\}
the rest follow the same theory. Hope you find this helpful!