mardi 15 juin 2021

Add a condtion for specfic row length in a script

I want to modify the following script:

awk 'NR>242 && $1 =='$t' {print $4, "\t" '$t'}' test.txt > file

I want to add a condition for the first "1 to 121" data (corresponding to the first 121 points) and then for the "122 to 242" data (which corresponds to the other 121 points).

so it becomes:

when NR>242 take the corresponding values of rows form 1 to 121 print them to file1

when NR>242 take the corresponding values of rows form 121 to 242 print them to file2

Thanks!

Aucun commentaire:

Enregistrer un commentaire