--- Booher Timothy B 1stLt AFRL/MNAC <[EMAIL PROTECTED]> wrote:
> Hello and thanks so much for your replies, but don't I need a \! To denote a
> literal ! and what about spaces before the bang - don't I want to lose them
> too - what about:

I don't know.  Do you want to lose them?  Up to you.  You should be aware that if you 
use -p, a
line will be printed for every line, regardless of how you structure things.  If you 
want to
*eliminate* said lines, use -n:

    perl -ni.bak -e 'print if $_ !~ /!/' list of files

Note that this is *very* dangerous.  This will simply delete every line with an 
exclamation point.
 Of course, the one-liners that we have shown you already will still mangle your 
programs beyond
repair if you're not careful (which is why I would think twice about doing this).

 
> perl -pi.bak -e 's/\s\!.*$//'
> 
> would that get rid of the spaces too?

Almost.  You need an asterisk after \s to show that you want to match zero or more.  
You are
matching exactly one whitespace character.

Cheers,
Curtis "Ovid" Poe

=====
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
"Ovid" on http://www.perlmonks.org/

__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to