Skip to content

Instantly share code, notes, and snippets.

@sevaine
Last active June 19, 2017 03:48
Show Gist options
  • Save sevaine/9244719 to your computer and use it in GitHub Desktop.
Save sevaine/9244719 to your computer and use it in GitHub Desktop.
remove all letters and numbers, replace space with underscore using awk
cat ${logfile} | awk '/^[A-Za-z0-9]/{gsub("[A-Za-z0-9]", "");gsub(" ","_");print}'
@sevaine
Copy link
Author

sevaine commented Jun 19, 2017

simpler alternative:

awk '/^[A-Za-z0-9]/{gsub("[A-Za-z0-9]", "");gsub(" ","_");print}' <FILE>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment