regex(3) Library Functions Manual regex(3)Name
re_comp, re_exec - regular expression handler
Syntax
char *re_comp(s)
char *s;
re_exec(s)
char *s;
Description
The subroutine compiles a string into an internal form suitable for pattern matching. The subroutine checks the argument string against
the last string passed to
The subroutine returns 0 if the string s was compiled successfully; otherwise a string containing an error message is returned. If is
passed 0 or a null string, it returns without changing the currently compiled regular expression.
The subroutine returns 1 if the string s matches the last compiled regular expression, 0 if the string s failed to match the last compiled
regular expression, and -1 if the compiled regular expression was invalid (indicating an internal error).
The strings passed to both and may have trailing or embedded newline characters; they are terminated by nulls. The regular expressions
recognized are described in the manual entry for given the above difference.
Diagnostics
The subroutine returns -1 for an internal error.
The subroutine returns one of the following strings if an error occurs:
No previous regular expression
Regular expression too long
unmatched (
missing ]
too many () pairs
unmatched )
See Alsoed(1), ex(1), egrep(1), fgrep(1), grep(1)regex(3)
Check Out this Related Man Page
regex(3) Library Functions Manual regex(3)Name
re_comp, re_exec - regular expression handler
Syntax
char *re_comp(s)
char *s;
re_exec(s)
char *s;
Description
The subroutine compiles a string into an internal form suitable for pattern matching. The subroutine checks the argument string against
the last string passed to
The subroutine returns 0 if the string s was compiled successfully; otherwise a string containing an error message is returned. If is
passed 0 or a null string, it returns without changing the currently compiled regular expression.
The subroutine returns 1 if the string s matches the last compiled regular expression, 0 if the string s failed to match the last compiled
regular expression, and -1 if the compiled regular expression was invalid (indicating an internal error).
The strings passed to both and may have trailing or embedded newline characters; they are terminated by nulls. The regular expressions
recognized are described in the manual entry for given the above difference.
Diagnostics
The subroutine returns -1 for an internal error.
The subroutine returns one of the following strings if an error occurs:
No previous regular expression
Regular expression too long
unmatched (
missing ]
too many () pairs
unmatched )
See Alsoed(1), ex(1), egrep(1), fgrep(1), grep(1)regex(3)
How do I check if the argument passed to a script is an integer?
I am writting a script that will take to integers and want to be able to check before I go on.
I am using bourne shell.
Thanks in advance (13 Replies)
Hi there
I have a file with a variable amount of rows but the 45th, 46th and 47th charachter of each line is the status field which is a three digit code ie 001, 002, 003 etc. My question is this..I need to strip all the records/lines with 002's out of the file completely and put them into... (14 Replies)
Hi All,
I have a text file below. How do i grab all the data between "05T00NPQSMR1" and "****" using awk ? Pls note that the text lines may not be fixed and text content is dynamic. Pls help. Thanks
Below is my code where $LOT_SUFFIX is my shell variable.
awk '/'"$LOT_SUFFIX"'/,/blah/'... (16 Replies)
Hi all,
until yesturday grep command was running in KSH ....
I was executing this command
ls -l | grep *.sh
But today its not working at all ...
Should I check any of the setting ...
I am not getting whats the problem ...
I have relogged to unix box but it didn't... (14 Replies)
I have following content in the file
CancelPolicyMultiLingual3=U|PC3|EN
RestaurantInfoCode1=U|restID1|1
.....
I am trying to use following matching extression
\|(+)
to get this
PC3|EN
restID1|1
Obviously it does not work.
Any ideas? (13 Replies)
I went through quite a few threads and didn't find anything on this. I also looked on other sites and couldn't turn up an answer.
For completeness sake, I'm working off of solaris 10 in the korn shell environment.
I wrote a script for a buddy to help him out with the following issue.
He... (12 Replies)
I have a script which has several occurences of statement like
command: $UCMDPATH/xyz abc
I would like to replace the entire line starting from $UCMDPATH with the ls -ltr command
eg:
Prior to change::
command: $UCMDPATH/xyz abc
After change:
command: ls -ltr
Is there a way to do... (12 Replies)
this is the content of the file:
i want to remove both the line starting with "=" and "(" but i can only remove one at a time..so how do I go about removing both of them? (15 Replies)
Hi guys,
can any one tell me how to create directories using regular expression?
Let's say that I need to create directories test01, test02, test03.... test10.
Can it be done using any regular expression?
thanks. (13 Replies)
Hi there,
I have a paramater file that looks like this :-
IRL|07122005|27389|VTIEpay|email address|5|200
When my program finishes I want to replace the seventh field. the existing code is like this
cat <<-EOF | ed -s $PARFILE
1,$ g/^$ICO/s/$prvdate/$TODAY/
1,$... (13 Replies)
Hi ,
I am having an issue with the Awk script to insert newline for a regular expression match
Having a file like this
FILE1
####################
RXOER , RXERA , RXERC , RXERD
.RXEA(RXBSN), RXERD , REXCD
input RXEGT
buffer RXETRY
#######################
Want to match the RXE... (38 Replies)
Hi,
temp="/usr=25,/usr/lib=12"
How to get only dir names with out values.
I tried like below but no use.
tmp=${temp##*,}
echo $tmp
o/p:
/usr/lib=12
expected o/p:
/usr /usr/lib ---> in array (13 Replies)
I have a file which I am reading and then I need to extract a particualr word and if it matches the line.
2015-01-22 07:30:17,814000 +0900 /INFO: - <ns2:virtualServerid="PH11PK" />
Means if the line contain Virtual server I need to extract the id .
Code I wrote#!/usr/bin/perl
... (19 Replies)