Help w/ matching grep and regular expressions
From: WH (nos.pam_at_email.com)
Date: 03/11/04
- Next message: Charlie Gibbs: "Re: first 200 charactes of an EBCDIC file"
- Previous message: Nick Landsberg: "Re: Question - reading command line parms inside a script."
- Next in thread: Alan Connor: "Re: Help w/ matching grep and regular expressions"
- Reply: Alan Connor: "Re: Help w/ matching grep and regular expressions"
- Reply: Nick Landsberg: "Re: Help w/ matching grep and regular expressions"
- Reply: Allan Chandler: "Re: Help w/ matching grep and regular expressions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 11 Mar 2004 03:18:25 GMT
I'm doing an assignment for a unix class, but I'm stuck on two questions.
3. Write a command that removes all files that end in a ".log" extension,
and do not contain the string "west". Remove them form your home directory,
and all subdirectories, recursively.
4. Write a command that produces the 'ls -l" output for the current
directory, but only lists files and directories for which the "other"
category (as opposed to "user" and "group" has execution permission.
With number 3, if I ignore the part about west, I would do a
find . -name *.log | xargs rm
But with the west there, I know I want to grep it, and have grep say
something like "match all lines except those with 'west'" but I can't figure
out how to do it. I scoured the web for an hour, and all I could find for
"except" was the ^carrot, which is useless here.
With number four, since permissions always have ten characters, I'd want to
match anything w/ ten characters, ending in x. I've got no idea how to
match the end of a word, just the end of a line w/ $.
- Next message: Charlie Gibbs: "Re: first 200 charactes of an EBCDIC file"
- Previous message: Nick Landsberg: "Re: Question - reading command line parms inside a script."
- Next in thread: Alan Connor: "Re: Help w/ matching grep and regular expressions"
- Reply: Alan Connor: "Re: Help w/ matching grep and regular expressions"
- Reply: Nick Landsberg: "Re: Help w/ matching grep and regular expressions"
- Reply: Allan Chandler: "Re: Help w/ matching grep and regular expressions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|