terminal - Delete lines in a file based on first row -


i try work on whole series of txt files (actually .out, behaves space delimited txt file). want delete lines in text, based on output compared first row.

so example:

id var1 var2 1 8 9 2 4 1 3 3 2 

i want delete lines var1 < 0,5.

i found way manually in excel, 350+ files, going long night, there sure ways more effective.. worked on set of files in terminal (osx).

this typical job awk, venerable language file manipulation.

what awk match each line in file condition, , provide action it. allows easy elementary parsing of line columns. in case, want test whether second column less 0.5, , if not print line. otherwise, print line (in effect removes lines variable less 0.5.

your variable in column 2, in awk referred $2. each full line referred variable $0.

so this:

{    if ($2 < 0.5) {      }      else {      print $0      } } 

or that, haven't used awk while. above code awk script. apply on file, , redirect output new file (which have lines not satisfying condition removed).