Sorry for such a basic question, but I have spent hours trying to work this out! I need an awk command (or similar) that will look at a text file and output to the screen if the 4th column of each line has a value greater than or equal to x.
data.txt
This is the 1 line
This is the 2 line
This is the 3 line
So if x was 2 I would expect it to output
This is the 2 line
This is the 3 line
I've found a number of awk command on the net that let you output if the string length is a certain size, but I can't find anything on how to check if a field has a certain value. Does such a command exist? (I'm using Solaris by the way)
Thanks for that it works a treat - typical of Unix to need such a long winded script for such a simple task!
Edit:- Just found an easier way of doing it. Weird that I searched this forum and didn't find a way, but once I have posted the question it appears in the "Similar Threads" bit down the bottom.
Anyhoo, this works a treat too (and is a lot shorter so I'll apologise to Unix for calling it long winded!): awk ' $4 > 2 ' data.txt