Linux Command Cheat Sheet/Print selected columns with awk

Extract columns from whitespace-delimited text.

Section: sed awk and Structured Text Workflows

Print selected columns with awk

bash
bash
awk '{print $1, $5}' access.log
Explanation

Great for quick field extraction and lightweight reporting.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing sed awk and Structured Text Workflows
Print file contents
Concatenate and print files to standard output.
OpenIn sheetbash1 tag match
Search text with grep
Print lines matching a pattern.
OpenIn sheetbash1 tag match
Show first lines
Display the first lines of a file.
OpenIn sheetbash1 tag match
Show last lines
Display the end of a file.
OpenIn sheetbash1 tag match
Count lines words and bytes
Count content in files or streams.
OpenIn sheetbash1 tag match
Number lines
Display file contents with line numbers.
OpenIn sheetbash1 tag match