Yes, you can put regular expression metacharacters in scripts and spotting *some* re's will be fairly easy - but spotting *ALL* re's will be quite a task.
Tell us a bit more about what you're trying to achieve. Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
I am not trying to accomplish anything in particular. It would just be nice to have the ability to test on re's like awk, sed or Perl. I figured there was but just didn't know the syntax. What were you thougthts?
Oh I see, well - you can use the standard command 'grep' to use regular expressions in a UNIX shell script.
You can use grep to process files or its STDIN - so you can echo or print variables to grep's STDIN to check those. Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
[COLOR=/blue]expr[/color] expr1 : expr2
The matching operator : compares the first argument
with the second argument which must be a regular
expression. expr supports the Basic Regular
Expression syntax (see regexp(5)), except that all
patterns are ``anchored'' (i.e., begin with ^) and,
therefore, ^ is not a special character, in that
context. Normally, the matching operator returns
the number of characters matched (0 on failure).
Alternatively, the \(...\) pattern symbols can be
used to return a portion of the first argument.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.