Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

awk print lines when match is found with specific field

# Basic awk syntax:
awk 'condition { print $0 }' input_file

# Example usage:
awk '$2 == "string_to_match" { print $0 }' input_file
# Where:
#	- this prints the entire line ($0) when field 2 ($2) is equal to the
# 		string "string_to_match"
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #awk #print #lines #match #specific #field
ADD COMMENT
Topic
Name
6+6 =