Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

simple grep command

Status
Not open for further replies.

Chrissirhc

Programmer
May 20, 2000
926
GB
Hi,

I'd like to grep for a string in particular set of files in a directory, without moving these files.

so I have in the diretory

chris1.log
chris2.log
chris3.log
chrisn.log
...
chris104.log

I'd like to find the string only in chris50.log through to chris60.log .

How would I do this?

Thanks,

Chris
 
grep <string> chris5[0-9].log will give you 50 to 59. Do you need 60 included?
 
Thanks,

I didn't realise you could use the regular expressions for the files. I had already tried this but forgot to put the .log at the end :) so assumed it didn't work.

If I needed the 60 what could I have done?

PS I posted something about the ps and top command just yesterday you wouldn't happen to know the answer?

Thanks,

Chris
 
Just add the chris60.log to the end of the above command. I'll take a look at the ps/top question. Cheers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top