I have:
1 LINUX param1 value1 2 LINUXparam2 value2 3 SOLARIS param3 value3 4 SOLARIS param4 value4
I need awk to print all lines in which $2 is LINUX.
$2
LINUX
In awk:
awk
awk '$2 == "LINUX" { print $0 }' test.txt
See awk by Example for a good intro to awk.
In sed:
sed
sed -n -e '/^[0-9][0-9]* LINUX/p' test.txt
See sed by Example for a good intro to sed.
2.1m questions
2.1m answers
60 comments
57.0k users