on Tue, Sep 09, 2003 at 07:57:28AM +0800, csj (csj@zapo.net) wrote:
> At Mon, 8 Sep 2003 11:41:17 +0100,
> Karsten M. Self wrote:
> > What it says is: substitute everything starting with the first
> > space or tab, any character, the string (which is preserved)
> > "/Subdirectory_", with a tab and the preserved string.
> >
> > Thinking about it, this might be better:
> >
> > s/[ ][^ ]*\(\/Subdirectory_\)/ \1/
> >
> > Which says: tab, followed by non-whitespace characters...
>
> Then this wouldn't work for the non-specific cases I have in
> mind. Both "Directory" and "Subdirectory" are variable. It can
> be ./Foo ./Dirfoo ./Pooh. I need to descend a certain number of
> subdirectories (/'s) down.
Well, if you want online help, post your problem in full and accurate
form. I can answer your question to the extent I understand it. I
can't read your mind (or inaccessble -- to me -- remote filesystem).
The basic techniques I've shown can be used with regexps and extended
regexps. sed, awk, and perl all use similar notation.
> BTW I just realized I have been using the regex forms you cited for a
> long time. In my .procmailrc!
Yes, regexps are a ubiquitous part of the 'Nix toolkit.
Peace.
--
Karsten M. Self <kmself@ix.netcom.com> http://kmself.home.netcom.com/
What Part of "Gestalt" don't you understand?
Defeat EU Software Patents! http://swpat.ffii.org/
Attachment:
pgpLs3WBcekfJ.pgp
Description: PGP signature