Sponsored Content
Top Forums Shell Programming and Scripting Grep command with multiple pattern Post 302460987 by Poonamol on Friday 8th of October 2010 06:32:20 AM
Old 10-08-2010
using this,
Code:
DB_ERR=`echo "$DB_TRANS" | egrep `(SP2- | ORA-)``

I am getting error as,
Code:
0403-057 Syntax error at line 50 : `(' is not expected.

So I removed brackets, but still not getting expected output.
Please help me out.
 

10 More Discussions You Might Find Interesting

1. Solaris

Multiple pattern on same line using grep

Hi, I would like to search multiple patterns on same line, i.e. all patterns must present on same line. Please suggest. Thanx (2 Replies)
Discussion started by: sanjay1979
2 Replies

2. Shell Programming and Scripting

Grep with multiple instances of same pattern

Hi, This is my text file I'm trying to Grep. Apple Location Greenland Rdsds dsds fdfd ddsads http Received Return Immediately Received End My Grep command: grep only--matching 'Location.*Received' e. Because the keyword Received appears twice, the Grep command will stop at the last... (0 Replies)
Discussion started by: spywarebox
0 Replies

3. Shell Programming and Scripting

Grep with multiple instances of same pattern

Hi, This is my text file I'm trying to Grep. Apple Location Greenland Rdsds dsds fdfd ddsads http Received Return Immediately Received End My Grep command: grep only--matching 'Location.*Received' Because the keyword Received appears twice, the Grep command will stop at the last... (3 Replies)
Discussion started by: spywarebox
3 Replies

4. Shell Programming and Scripting

Grep multiple line pattern and output the lines

Hi I have the following Input -- -- TABLE: BUSINESS_UNIT -- ALTER TABLE RATINGS.BUSINESS_UNIT ADD CONSTRAINT FK1_BUSINESS_UNIT FOREIGN KEY (PEOPLESOFT_CHART_FIELD_VALUE_ID) REFERENCES RATINGS.PEOPLESOFT_CHART_FIELD_VALUE(PEOPLESOFT_CHART_FIELD_VALUE_ID) ; ALTER TABLE... (1 Reply)
Discussion started by: pukars4u
1 Replies

5. Shell Programming and Scripting

How to grep multiple pattern from XML file

Hi Everyone pls if anyone can help me in writing a script or correcting it what I have done. I want to write a script to grep record number for all those record which have abc xyd cat dog in one of the field say VALUE, I have thousand of file in a dir and I want to search every file for... (6 Replies)
Discussion started by: revertback
6 Replies

6. Shell Programming and Scripting

Grep text between multiple pattern

Hello everybody, I have been looking around but can't figure how to do a grep command, that find the text between multiple patterns, example: (pattern1 OR pattern2) AND (pattern3 OR pattern4) text that I want (pattern5 OR pattern6) AND (pattern7 OR pattern8) So how do I find the "text... (4 Replies)
Discussion started by: Benou
4 Replies

7. Linux

Creating 2 variables from a multiple pattern grep

first time poster here Im pretty new to grep and linux in general and I spent pretty much all day yesterday researching and coming up with a grep command to help with my university project. I am attempting to create a proof of concept bash script to scan the network using ngrep, find appropriate... (7 Replies)
Discussion started by: scottish_jason
7 Replies

8. Shell Programming and Scripting

sed command to grep multiple pattern present in single line and delete that line

here is what i want to achieve.. i have a file with below contents cat fileName blah blah blah . .DROP this REJECT that . --sport 7800 -j REJECT --reject-with icmp-port-unreachable --dport 7800 -j REJECT --reject-with icmp-port-unreachable . . . more blah blah blah --dport 3306... (14 Replies)
Discussion started by: vivek d r
14 Replies

9. Shell Programming and Scripting

sed and awk usage to grep a pattern 1 and with reference to this grep a pattern 2 and pattern 3

Hi , I have a file where i have modifed certain things compared to original file . The difference of the original file and modified file is as follows. # diff mir_lex.c.modified mir_lex.c.orig 3209c3209 < if(yy_current_buffer -> yy_is_our_buffer == 0) { --- >... (5 Replies)
Discussion started by: breezevinay
5 Replies

10. Shell Programming and Scripting

Grep multiple pattern

I have got a text from each line, I need to fetch port only if there is an ip a.text text and port=25 b.ip=(12.32.54.256) and port="52" c.ip=(55.251.253.12) and port=25" d.text text and port="5" e.ip=(45.211.155.15) and port="457" f.ip=(144.158.256.2) and port="588" I know how to... (6 Replies)
Discussion started by: arpagon
6 Replies
GREP(1) 						      General Commands Manual							   GREP(1)

NAME
grep - search a file for a pattern SYNOPSIS
grep [ option ... ] pattern [ file ... ] DESCRIPTION
Grep searches the input files (standard input default) for lines (with newlines excluded) that match the pattern, a regular expression as defined in regexp(6). Normally, each line matching the pattern is `selected', and each selected line is copied to the standard output. The options are -c Print only a count of matching lines. -h Do not print file name tags (headers) with output lines. -i Ignore alphabetic case distinctions. The implementation folds into lower case all letters in the pattern and input before interpre- tation. Matched lines are printed in their original form. -l (ell) Print the names of files with selected lines; don't print the lines. -L Print the names of files with no selected lines; the converse of -l. -n Mark each printed line with its line number counted in its file. -s Produce no output, but return status. -v Reverse: print lines that do not match the pattern. Output lines are tagged by file name when there is more than one input file. (To force this tagging, include /dev/null as a file name argument.) Care should be taken when using the shell metacharacters $*[^|()= and newline in pattern; it is safest to enclose the entire expression in single quotes '...'. SOURCE
/sys/src/cmd/grep.c SEE ALSO
ed(1), awk(1), sed(1), sam(1), regexp(6) DIAGNOSTICS
Exit status is null if any lines are selected, or non-null when no lines are selected or an error occurs. GREP(1)
All times are GMT -4. The time now is 10:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy