Print the first colon-separated field.
awk -F: '{print $1}' /etc/passwdProcess text by fields and patterns; fields are separated by whitespace by default.
awk [OPTION]... 'PROGRAM' [FILE]...Print the first colon-separated field.
awk -F: '{print $1}' /etc/passwdPrint the first and third fields where the third exceeds 100.
awk '$3 > 100 {print $1, $3}' scores.txt| Option / clause | Description |
|---|---|
-F FS, --field-separator=FS | Set the input field separator. |
-v VAR=VALUE | Assign a variable before the program runs. |
-f FILE | Read the awk program from FILE. |
-e PROGRAM | Add program source text. |
-i FILE | Load an awk extension library (gawk). |
Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.