i know it is very basic question but im total new in shell scripting
i a txt file called 'berkay' and content of it is like
03:05:16 debug blablabla1
03:05:18 error blablablablabla2
05:42:14 degub blabblablablabal
06:21:24 debug balbalbal1
I want to print the lines whose second column is error so the output will be
03:05:18 error blablablablabla2
I am thinking about something like " if nawk { $2}" but i need help.
With this for example:
$ awk '$2=="error"' file
03:05:18 error blablablablabla2
Why is this working? Because when the condition is true, awk
automatically performs its default behaviour: {print $0}
. So there is no need to explicitly write it.