search directory

Search Commands

Search tools, operations, flags, and command strings. Results are capped for Worker performance.

Awk Commands

30 awk entries

Limited to 100 results

Back to all tools
awk

Awk Command: Conditional Print Values

awk '{if ($1 == "foo") print "Exact match foo"; else if ($1 ~ "bar") print "Partial match bar"; else print "Baz"}' <path/to/file>
awk

Awk Command: Conditional Printing

awk '{if ($1 == "foo") print "Exact match foo"; else if ($1 ~ "bar") print "Partial match bar"; else print "Baz"}' <path/to/file>
awk

Awk Command: Conditional Printing Values

awk '{if ($1 == "foo") print "Exact match foo"; else if ($1 ~ "bar") print "Partial match bar"; else print "Baz"}' <path/to/file>
awk

Awk Command: Conditional Printing

awk '{if ($1 == "foo") print "Exact match foo"; else if ($1 ~ "bar") print "Partial match bar"; else print "Baz"}' <path/to/file>
awk

Awk Command: Print Column Between Min Max

awk '($10 >= <min_value> && $10 <= <max_value>)' <path/to/file>
awk

Awk Command: Print Columns Between Min Max

awk '($10 >= <min_value> && $10 <= <max_value>)' <path/to/file>
awk

Awk Command: Print Every Third Line

awk 'NR%3==1' <path/to/file>
awk

Awk Command: Print Every Third Line Starting From First

awk 'NR%3==1' <path/to/file>
awk

Awk Command: Print Fifth Column

awk '{print $5}' <path/to/file>
awk

Awk Command: Print Fifth Column Space Separated File

awk '{print $5}' <path/to/file>
awk

Awk Command: Print Last Column Comma Separated File

awk -F ',' '{print $NF}' <path/to/file>
awk

Awk Command: Print Last Column Comma Separator

awk -F ',' '{print $NF}' <path/to/file>
awk

Awk Command: Print Lines With 10th Column Between Min And Max

awk '($10 >= <min_value> && $10 <= <max_value>)' <path/to/file>
awk

Awk Command: Print Lines Within Column Range

awk '($10 >= <min_value> && $10 <= <max_value>)' <path/to/file>
awk

Awk Command: Print Second Column Containing Foo

awk '/<foo>/ {print $2}' <path/to/file>
awk

Awk Command: Print Second Column Foo

awk '/<foo>/ {print $2}' <path/to/file>
awk

Awk Command: Print Second Column With Foo

awk '/<foo>/ {print $2}' <path/to/file>
awk

Awk Command: Print User Table With Uid Ge 1000

awk 'BEGIN {FS=":";printf "% -20s %6s %25s\n", "Name", "UID", "Shell"} $4 >= 1000 {printf "% -20s %6d %25s\n", $1, $4, $7}' /etc/passwd
awk

Awk Command: Print Users With Uid 1000

awk 'BEGIN {FS=":";printf "% -20s %6s %25s\n", "Name", "UID", "Shell"} $4 >= 1000 {printf "% -20s %6d %25s\n", $1, $4, $7}' /etc/passwd
awk

Awk Command: Print Users With Uid Format

awk 'BEGIN {FS=":";printf "%-20s %6s %25s\n", "Name", "UID", "Shell"} $4 >= 1000 {printf "%-20s %6d %25s\n", $1, $4, $7}' /etc/passwd
awk

Awk Command: Print Users With Uid Greater Than 1000

awk 'BEGIN {FS=":";printf "%-20s %6s %25s\n", "Name", "UID", "Shell"} $4 >= 1000 {printf "%-20s %6d %25s\n", $1, $4, $7}' /etc/passwd
awk

Awk Command: Print Every Third Line

awk 'NR%3==1' <path/to/file>
awk

Awk Command: Print Fifth Column

awk '{print $5}' <path/to/file>
awk

Awk Command: Print Last Column Comma Separator

awk -F ',' '{print $NF}' <path/to/file>
awk

Awk Command: Print Lines With Column In Range

awk '($10 >= <min_value> && $10 <= <max_value>)' <path/to/file>
awk

Awk Command: Print Second Column Containing Foo

awk '/<foo>/ {print $2}' <path/to/file>
awk

Awk Command: Print Users With Uid Greater Than 1000

awk 'BEGIN {FS=":";printf "%-20s %6s %25s\n", "Name", "UID", "Shell"} $4 >= 1000 {printf "%-20s %6d %25s\n", $1, $4, $7}' /etc/passwd
awk

Awk Command: Sum First Column

awk '{s+=$1} END {print s}' <path/to/file>
awk

Awk Command: Sum First Column Values

awk '{s+=$1} END {print s}' <path/to/file>
awk

Awk Command: Sum First Column

awk '{s+=$1} END {print s}' <path/to/file>