Skip to content

Instantly share code, notes, and snippets.

@jappy
Created March 10, 2012 18:16
Show Gist options
  • Save jappy/2012357 to your computer and use it in GitHub Desktop.
Save jappy/2012357 to your computer and use it in GitHub Desktop.
unix command to extract words from a file (Mac/Linux)
tr -sc 'A-Za-z' '\n' < filename.txt
@jappy
Copy link
Author

jappy commented Mar 10, 2012

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