LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices


Reply
  Search this Thread
Old 03-25-2008, 11:37 AM   #1
shabev
LQ Newbie
 
Registered: Mar 2008
Posts: 4

Rep: Reputation: 0
use greater than or equal to operators on a file/output


Hi

Can any one help me for the following query.

I have one file which has the entries like as follows

Mar 23 09 abcd
Mar 24 09 abcd
Mar 24 11 pqrs
Mar 25 13 wxyz
Mar 25 13 wxyz
Mar 26 22 abcd
Mar 26 01 abcd
Mar 26 02 abcd
Mar 27 03 wxyz
Mar 27 06 wxyz
Mar 28 06 wxyz
Mar 29 07 pqrs
Mar 29 07 pqrs

I just want to find out the values which is greater than "Mar 25"

On the basis of second column value I want to print?

output should be all the entries greater than or equal to "25"

How can we use operators here in this example?

Please help me on this query
 
Old 03-25-2008, 12:50 PM   #2
ronlau9
Senior Member
 
Registered: Dec 2007
Location: In front of my LINUX OR MAC BOX
Distribution: Mandriva 2009 X86_64 suse 11.3 X86_64 Centos X86_64 Debian X86_64 Linux MInt 86_64 OS X
Posts: 2,369

Rep: Reputation: Disabled
I do not do programing any more this days ,but as I remember the Bolean expression where :
IF
And
Or
>
<

equals 0r >
Eguals Or <

The last 2 expression I can not find them on my keyboard using this expression it must be not to difficult to do what you like to do But I do not know if you can use them in the programming language you use
Hopefully this use full for you

all the best
 
Old 03-25-2008, 02:03 PM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Do you want to test:
Numbers greater than 25?
OR
Dates greater than March 25?

(There is a big difference in the code...)

The best way to deal with this kind of thing is to download a copy of the Advanced Bash Scripting Guide and use it for searching. Here is a link to the relevant section:

http://tldp.org/LDP/abs/html/comparison-ops.html
(This is for the simple number test)
 
Old 03-25-2008, 02:09 PM   #4
prad77
Member
 
Registered: Mar 2008
Posts: 101

Rep: Reputation: 15
awk '{ if ($1==MAR && $2 > 25) print $0 }'

hope this helped.

Fedora Development

Last edited by prad77; 04-17-2008 at 03:24 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Meta file does not equal check sum, Stuarts-Burgers Linux - Software 1 12-26-2007 03:34 AM
UNZIP of a file greater than 4GB FAILED on AIX 5.2 ! aqeel786 AIX 3 11-24-2006 07:50 AM
How sort data in some file which are greater than some value? sarajevo Programming 5 08-25-2006 03:48 AM
bash script test file operators... bulliver Programming 3 10-17-2003 12:06 PM
i can upload file that is greater than 1MB marconi8 Linux - General 0 12-17-2002 09:13 AM

LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 12:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration