Friday, 15 June 2012

awk all lines of the input file where first and the second field are the same -


I have been given time here with the following tasks. I need to print all the rows in the input file where the first matches the field 2. Here is my syntax, which is not apparently working: awk '$ 1 == $ 2 {print $ 0}' & lt; Input file, what's wrong?

The third area will be $ 3 , no?

  awk '$ 1 == $ 3' inputfile   

(Since we are here, you are print $ 0 Which is contained, and redirection.)

No comments:

Post a Comment