Hi,
How can I tell awk to print all lines/columns if column number 5 contains the word Monday?
I have tried
nawk -F, '$5==Monday' OFS=, myfile > outputfile
but that doesn't work (I am a newb!!)
Thanks,
Hi,
How can I tell awk to print all lines/columns if column number 5 contains the word Monday?
I have tried
nawk -F, '$5==Monday' OFS=, myfile > outputfile
but that doesn't work (I am a newb!!)
Thanks,
use :
awk -F, '{$5==Monday}1' OFS=, file
awk -F, '{$5==Monday}1' OFS=, file > newfile
Doesn't seem to work. newfile just contains the same contents as file
Thanks,
Post ur source file please
Source File:
mr,bob,bobson,Monday,20,france
mrs,caroline,godsom,Monday,30,Germany
mrs,sarah,bishop,Wednesday,10,UK
mr,karl,jacobs,Thursday,29,spain
mr,trevor,duell,Monday,34,belgium
miss,kate,dartsen,Wednesday,76,Austria
Thanks,
Wrong field and lack of double quotes:
nawk -F, '$4=="Monday"' OFS=, myfile > outputfile
grep -E "(.[^,]*),(.[^,]*),(.[^,]*),[ \t]*Monday[ \t]*" file
Post deleted