![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| replacing numbers greater than 0 with 1 | vrms | Shell Programming and Scripting | 4 | 06-04-2008 07:40 AM |
| greater than less than in case | sars | Shell Programming and Scripting | 2 | 02-18-2007 12:37 PM |
| AWK greater than 200 | insania | Shell Programming and Scripting | 2 | 02-05-2007 03:03 PM |
| length of data greater than 11 | thanuman | UNIX for Dummies Questions & Answers | 2 | 09-10-2004 07:13 AM |
| Greater Than | Lem2003 | Shell Programming and Scripting | 2 | 08-29-2003 10:06 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
AWK greater than?
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 any help. |
|
||||
|
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 |
![]() |
| Bookmarks |
| Tags |
| solaris |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|