boneman147 has asked for the wisdom of the Perl Monks concerning the following question:
Hi all, I am trying to take an expression in shell that works for me and translate it into Perl however it is giving me fits! Basically I'm trying to grep out all instance of /usr, /platform, /sbin and /lib in a file and return all other lines to a file. This is the bit that strips out the exceptions:
egrep -v '^/usr$|^/sbin$|^/platform$|^/lib$' <file name>
In Perl I have tried:
grep /!^(\/usr|\/sbin|\/platform|\/lib)$/
This didn't do it. Tried many variations that ended in error. Any help on this would be greatly appreciated!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using grep to find "/<file system"
by choroba (Cardinal) on Oct 14, 2011 at 12:51 UTC | |
|
Re: Using grep to find "/<file system"
by Eliya (Vicar) on Oct 14, 2011 at 13:03 UTC | |
|
Re: Using grep to find "/<file system"
by hbm (Hermit) on Oct 14, 2011 at 13:43 UTC | |
|
Re: Using grep to find "/<file system"
by MidLifeXis (Monsignor) on Oct 14, 2011 at 13:04 UTC | |
|
Re: Using grep to find "/<file system"
by boneman147 (Initiate) on Oct 14, 2011 at 14:39 UTC | |
by johngg (Canon) on Oct 14, 2011 at 16:06 UTC | |
by pvaldes (Chaplain) on Oct 14, 2011 at 15:55 UTC | |
by anneli (Pilgrim) on Oct 15, 2011 at 09:22 UTC | |
|
Re: Using grep to find "/<file system"
by Anonymous Monk on Oct 14, 2011 at 13:01 UTC |