Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

verify arbitrary column

Status
Not open for further replies.

userand

Technical User
Apr 12, 2011
28
CH
Hello,

I would like to check the values of the columns of a file, which numbers are arbitrary... For example these are the three lines (records) of a file

1 1 1 2 2 2
1 1 1 2 3
1 1 3 2 3 2 1 1

In this case I would like to print out those records, in which value of every column is not greater than 2, i.e. int this case the first one.

I would like to figure out a standard method, which is working even if I have thousands of lines, which has non-constant number of columns..

Thanks in advance!
 
A starting point:
Code:
awk '{for(i=1;i<=NF;++i)if($i>2)next}1' /path/to/input

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top