Re: newbie question about regex
Hello, I call my script with the following line $ ./count.pl /var/log/file text this works fine but sometimes the text is foo(bar) and then my scripts gives an error. syntax error near unexpected token `foo(b' I believe the syntax error is from your shell and you can get around this by quoting your string to search on... $ ./count.pl /var/log/file 'foo(bar)' Should do it. snip http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: newbie question about regex
Hello, I call my script with the following line $ ./count.pl /var/log/file text this works fine but sometimes the text is foo(bar) and then my scripts gives an error. syntax error near unexpected token `foo(b' I believe the syntax error is from your shell and you can get around this by quoting your string to search on... $ ./count.pl /var/log/file 'foo(bar)' Should do it. Sometimes,... even the most simple problems could take several hours to understand until you ask and somebody's gives th right answer, Thanks everybody for the quick and right answer With kind regards, Maurice Lucas TAOS-IT -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: newbie question about regex
On Fri, Sep 03, 2004 at 04:33:43PM +0200, Maurice Lucas wrote: $ ./count.pl /var/log/file text this works fine but sometimes the text is foo(bar) and then my scripts gives an error. syntax error near unexpected token `foo(b' That's a shell issue, not a Perl issue. Escape your brackets or quite your text so that bash (or sh or whatever) won't try to do something special with it. -- David Dorward http://dorward.me.uk -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response