I would like to separate those rows where the value in second column is smaller than a specific value. example input:id1 19501112id2 19831207id3 20001212id6 20000101id10 20061213id11 20081212id12 20100109id13 20101218id14 20101212id15 20111111id16 20150919id20 20141415and I want to extract those rows whose second field's value is less than 20100101. So, my output would be:id1 19501112id2 19831207id3 20001212id6 20000101id10 20061213id11 20081212any suggestion please?
How to split a file based on information within a column in linux
shell;text processing;sed;awk
$ awk '$2<20100101' fileid1 19501112id2 198312071d3 20001212id6 20000101id10 20061213id11 20081212A typical awk program consists of commands that look like:condition { action }In our case, the condition is that the second column be less than 20100101.  This condition is, reasonably enough, written as $2<20100101.  Because we provide no action, awk does the default action which is to print the line.