--- Booher Timothy B 1stLt AFRL/MNAC <[EMAIL PROTECTED]> wrote: > o.k. another regex issue . . . I want a one-liner that can remove everything > after a given character: i.e. > > in this case everything after ! (fortran comment): > > would this work: > > perl -npe 's/\!.+$//' > > my thinking is that \! Is the literal character and . would count for > anything + would represent any number of anything and $ would symbolize the > end of the line. Am I close, if so how close? > > Thanks so much, > > tim
Ugh. In my previous example, I had non-capturing parens and made it optional. I had them because this was a slightly different regex, originally. What follows is better (with the caveat that any exclamation points that don't mark quotes are going to cause problems. perl -pi.bak -e 's/!.*$//' list of files 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]