bash - Print out lines have value great than 1 with awk -


i trying pull out data in file of value in line great 1. guys know easy way this?

awk -f"\t" '{if(($3>1)||($4>1)||($5>1)||($6>1)||($7>1)||($8>1)||($9>1)||($10>1)||($11>1)||($12>1)||($13>1)||($14>1)||($15>1)||($16>1)||($17>1)||($18>1))print$0}' file1.txt > file2.txt 

you can use for loop in awk instead of writing many many conditions:

awk -f"\t" '{for(i=3; i<=18; i++){if($i>1){print $0; next;}}}' filename 

if wish comapare column 3 last column, use nf instead of 18 in loop condition.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -