![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| SED Search Pattern and Replace with the Pattern | racbern | Shell Programming and Scripting | 4 | 03-15-2008 02:59 AM |
| Search for a pattern | DNAx86 | Shell Programming and Scripting | 26 | 03-12-2008 04:03 AM |
| pattern search | ali560045 | Shell Programming and Scripting | 2 | 11-28-2007 05:04 AM |
| Search file for pattern and grab some lines before pattern | frustrated1 | Shell Programming and Scripting | 2 | 12-22-2005 12:41 PM |
| how to search the pattern | vasikaran | UNIX for Dummies Questions & Answers | 2 | 06-30-2005 01:34 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Search for a pattern from the result of search
I want to search for a pattern in a file based on the result of search. For example,
grep '05-Dec' filename.ext For searching 'Exception' pattern, I used, grep 'Exception' filename.ext Anyway, these two worked successfully when run individually. But I want to search the second pattern based on the result of the first pattern. Please help me out. |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
U have to understand the use of pipes:
Code:
grep '05-Dec' filename.ext|grep 'Exception' |
|
#3
|
|||
|
|||
|
Code:
awk '/05-Dec/ && /Exception/{print}' file
|
|
#4
|
||||
|
||||
|
That“s better, just a minor thing u can drop print
Code:
awk '/05-Dec/ && /Exception/' file |
||||
| Google The UNIX and Linux Forums |