![]() |
|
|
|
|
|||||||
| 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 |
| How to Convert Hex value to Dec ? | Nayanajith | Shell Programming and Scripting | 6 | 08-05-2008 01:30 AM |
| convert to GB | melanie_pfefer | Shell Programming and Scripting | 6 | 03-03-2008 10:05 AM |
| to convert int to hex | naan | High Level Programming | 8 | 12-21-2007 11:13 AM |
| How to convert Dat to Bin | ravi.sadani19 | UNIX for Advanced & Expert Users | 3 | 08-06-2007 08:03 AM |
| here-doc convert 2 script convert to single script? | yongho | Shell Programming and Scripting | 2 | 07-07-2005 01:14 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to convert grep to sed??
Hi,
I am hing problem in grep.. So I need convert following code to sed based one.. grep -ie "error|exception" $LOG_DIR/Node$i\Log.txt >> $LOG_ERR_REP thats is I want to serach error and exception (ignore case) and write to other file . how to do? |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
You can try as,
sed -e "/[eE][rR][rR][oO][rR]/p;/[eE][xX][cC][eE][pP][tT][iI][oO][nN]/p" $LOG_DIR/Node$i\Log.txt >> $LOG_ERR_REP It will work. |
|
#3
|
|||
|
|||
|
Hi,
Thanks for your help.. But its giving file not containing Error (error) and Exception(and exception) line too??? |
|
#4
|
|||
|
|||
|
There is an error in my reply. use this,
sed -n '/[eE][rR][rR][oO][rR]/p;/[eE][xX][cC][eE][pP][tT][iI][oO][nN]/p' $LOG_DIR/Node$i\Log.txt >> $LOG_ERR_REP |
|
#5
|
|||
|
|||
|
thanks ..its working
|
|
#6
|
||||
|
||||
|
Quote:
grep -i -E "error|exception" file >> another_file Or, if you're not using GNU grep egrep -i "error|exception" file >> another_file Also; why are you backslash escaping the L of Log.txt? Cheers ZB |
||||
| Google The UNIX and Linux Forums |