Operating System - HP-UX
1753477 Members
4880 Online
108794 Solutions
New Discussion юеВ

Re: Arithemetic operator on a file/output

 
SOLVED
Go to solution
vvsha
Frequent Advisor

Arithemetic operator 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
3 REPLIES 3
Heiner E. Lennackers
Respected Contributor
Solution

Re: Arithemetic operator on a file/output

You can do it with awk:

awk '$2 >= 25 { print $0 }' /path/to/yourfile

will print out what you want to the standard output

HeL
if this makes any sense to you, you have a BIG problem
OldSchool
Honored Contributor

Re: Arithemetic operator on a file/output

Basically, you've asked 3 separate, though seemingly related, questions, both in this thread and here:

http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1215980

Given your sample data:

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
Mar 29 07 pqrs

You've listed various, often contradictory requirements, such as "remove duplicates", field 2 > 25 and so forth. In the case of "remove duplicates", you don't specify what constitutes a duplicate (ie. field 4 the same, fields 1-4 match exactly and so forth).

A clear, concise definition of the requirement would go a long way towards getting the correct answer.
vvsha
Frequent Advisor

Re: Arithemetic operator on a file/output

Thank you very much