lundi 1 août 2016

Find same name of text file like in the first column and print text if condition is true

I have one text file and folder with another text files, delimited by tab. I would like to use condition if value smaller than 0 print specific text to another file with another condition.

For example:

  1. file:
112   0.6
116  -0.3
198  -0.7
205   0.4

  1. folder, where is 4 files with same name like in 1. file in first column.
112.tsv
116.tsv -here i would like to add last row with "This is the row what I want"
198.tsv -here i would like to add last row with "This is the row what I want"
205.tsv

I would like to use awk code:

awk '{if ($2<=0); print "This is the row what I want" "?? to file with same name like $1 ??"}' 1.file

Please could you help me?

Aucun commentaire:

Enregistrer un commentaire