1

I have a file with six columns, and I only want to print the first two columns of the lines that have a value >3 in the sixth column.

This statement prints all lines where the sixth column > 3

awk '$6 > 3' file > out

This statement prints the first two columns:

awk '{print $1,$2}' file > out 

Anyone knows how to combine these two commands into a one-liner?

1 Answer 1

2

you are almost there,just as you said, "combine them"! . try this:

awk '$6>3{print $1,$2}' file >out
Sign up to request clarification or add additional context in comments.

1 Comment

Did not expect it to be that easy... Thanks!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.