1751695 Members
4660 Online
108781 Solutions
New Discussion юеВ

egrep question

 
bob hollis
Frequent Advisor

egrep question

I am using egrep to pick some information out of an Oracle export.
I am using the following:
cat export.dmp|egrep "F983051|F98306|F98720|F98740|F98741|F98743"
What is the maximum length of the string I can use? It seems if I put too many table names in the string I get no results.
Any other ideas how to do this?
5 REPLIES 5
Massimo Bianchi
Honored Contributor

Re: egrep question

You can use a file, with the option -f "filename"

Massimo
Massimo Bianchi
Honored Contributor

Re: egrep question

Hi,
thinking a little more: would it ne more usefull if you do a fake import ?

egrep-ping an oracle dump is not very usefull, but an import with

indexfile=file1.txt show=y

will be more usefull

Massimo
Francisco J. Soler
Honored Contributor

Re: egrep question

Hi, you can do it with awk.

cat export.dmp | awk '
/F983051/
/F98306/
/F98720/
/F98740/
/F98741/
/F98743/
....
'

It is not needed the print statement because is the default one.

HTH
Frank
Linux?. Yes, of course.
john korterman
Honored Contributor

Re: egrep question

Hi Bob,
I do not know the limit, but perhaps you can shorten your reg. expression string by organizing it for matching ranges, e.g.:
# egrep "F9830[5-6]*|F987[1-2][0-1]" export.dmp

which will match the strings:
F98305 + whatever comes after
F98306 + whatever comes after
F98710
F98711
F98720
F98721

Regards,
John K.
it would be nice if you always got a second chance
Caesar_3
Esteemed Contributor

Re: egrep question

Hello!

You can use perl,

open (FH, filename);

foreach ()
{
if (/F983051|F98306|F98720|F98740|F98741/)
{
print "Found: $_";
}
}
close (FH);

Caesar