Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
Showing results for 
Search instead for 
Did you mean: 

egrep question

Super Advisor

egrep question

I want to egrep for certain fields which are not existing in the current log files and am getting errors for that...

egrep "'^20090220.14'|'^20090220.15'|'^20090220.16'|'^20090220.17'|'^20090220.18'"

Some of the times are in future and logs don't have those entries and I get errors for them ... what should I do?

Steven Schweda
Honored Contributor

Re: egrep question

> what should I do?

First, show an actual command with its actual
output. "I get errors" is not a useful
description of what you did, nor of what
happened when you did it.
Dennis Handly
Acclaimed Contributor

Re: egrep question

>I want to egrep for certain fields

Why not use just grep?
grep -e "'^20090220.14'" -e "'^20090220.15'" ...

Any reason you have single quotes inside of double? This will hide the "^" if you intend to anchor at the start of the line:
grep -e "^20090220.14" -e "^20090220.15" ...

>which are not existing in the current log files and am getting errors for that

If they don't exist, you can't find them. What grep errors would you get?
Valued Contributor

Re: egrep question

Why not just do it like this?
egrep "^20090220\.1[4-8]" file.txt

Seems like a mess to make several "or"-statements for this.

Also, the quotation seems unneccessery as Dennis pointed out.

And you should assign some points to those who answered a week ago.

Best regards
Fredrik Eriksson