Skip to content

Instantly share code, notes, and snippets.

@mlvea
Created August 22, 2018 02:08
Show Gist options
  • Save mlvea/475e7d965c29a5a25fc748497b86f300 to your computer and use it in GitHub Desktop.
Save mlvea/475e7d965c29a5a25fc748497b86f300 to your computer and use it in GitHub Desktop.
AWK Examples[Field Separator, Skip comments, Beginning Text]: Read /etc/passwd and format.
awk '/^#/ {next} BEGIN {FS=":"; print "\Name\tUserID\tGroup\tHomeDirectory"} { print $1"\t"$3"\t"$4"\t"$6}' /etc/passwd
@mlvea
Copy link
Author

mlvea commented Aug 22, 2018

/^#/ {next} Skip to the next line if the line begins with #.
FS=":" Set the field separator to ":"

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