Created
August 22, 2018 02:08
-
-
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.
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
awk '/^#/ {next} BEGIN {FS=":"; print "\Name\tUserID\tGroup\tHomeDirectory"} { print $1"\t"$3"\t"$4"\t"$6}' /etc/passwd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
/^#/ {next}
Skip to the next line if the line begins with #.FS=":"
Set the field separator to ":"