print whole line if the 1st field contains...

i want to print lines in a file that the 1st field of each line has a Date shape such:

yy/mm/dd

or on the other hand contains slash "/" .

This should do it:

awk '$1 ~ "/"'

or maybe

awk '$1 !~ "/"'

or even

awk '$1 ~ "[0-9][0-9]/[0-9][0-9]/[0-9][0-9]"'

depending on how your requirements are to be understood.

1 Like