![]() |
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 |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Compare two arrays in sh or compare two fields | rijeshpp | Shell Programming and Scripting | 0 | 10-31-2007 02:47 AM |
| how to exclude the GREP command from GREP | yamsin789 | UNIX for Advanced & Expert Users | 2 | 10-05-2007 02:59 AM |
| Make grep -c display like grep -n? | Jerrad | Shell Programming and Scripting | 2 | 08-25-2006 12:20 AM |
| How to compare it ?? | sabercats | Shell Programming and Scripting | 4 | 02-16-2006 06:07 PM |
| LPP Compare | Smoker | AIX | 2 | 06-09-2005 01:43 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
compare grep?
is there any way to compare two grep commands in an if statement? like:
if grep blah = grep blah blah then is there a way to store the values of the greps and compare them? the greps are counting pattern matches in two different files and i need to make sure they match. |
|
||||
|
i guess i wasn't specific enough, the compare is a little complicated. In one file i am counting the instances of the pattern with grep -c and i want to compare that count to the value in field 3 of another file where field 1 = C
so, let me try to explain a little easier, i want to compare the values of these two statements: grep -c <pattern> <file> grep "^C" <file> | awk -F'|' '{print $3}' if there is an easier way to do this i'm all ears, i don't even know if this is possible to begin with so any input is appreciated |
|
||||
|
C| |00000009| |00000000|
so in other words, i'm counting in one file the number of time s pattern comes up and i want to see if that number matches the number in field 3, in this case it's 9, do I have to account for the leading zeros in the field when comparing? |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|