Created
March 10, 2012 18:16
-
-
Save jappy/2012357 to your computer and use it in GitHub Desktop.
unix command to extract words from a file (Mac/Linux)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tr -sc 'A-Za-z' '\n' < filename.txt |
This command takes the complement of [A-Za-z] which is all non-alphabetic characters and converts them into newlines '\n' (-c parameter). It also squeezes all successive newlines into a single newline (-s parameter).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From the tr man page (http://unixhelp.ed.ac.uk/CGI/man-cgi?tr+1):