stright from Mastering Regular Expresstions by Oreilly page 124
this should all be on 1 line btw. the reason 0-9 wont work as mentioned above it cuz if you want a ligit ip all the time 0-9 wont work. remember 0-9 says even an ip of 999.999.999.999 is valid when we all know is not valid in any universe (yet anyways).
btw this book is a book i think everyone that is into unix, programing, scripting should read.
the hostname check is on page 167
Last edited by Optimus_P; 09-04-2001 at 06:38 PM..
i cant get around using regular expressions in if/else statements. it simply doesnt give me the right results.
i've tried using switch/case but that is just as sh!tty as well. (pardon my french but im getting frustrated with c shell..only reason why im writing in it is because it's a hwk... (3 Replies)
How can i create a regular expression which can detect a new line charcter followed by a special character say * and replace these both by a string of zero length?
Eg:
Input File san.txt
hello
hi ... (6 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)
Hi Gurus,
I need help with regular expressions. I want to create a regular expression which will take only alpha-numeric characters for 7 characters long and will throw out an error if longer than that.
i tried various combinations but couldn't get it, please help me how to get it guys.
... (2 Replies)
I am have a configuration script that my shell script uses. There is a regular expression defined for the input file. How do execute the shell script and pass the name of the input file using a regular expression.
I would greatly appreciate some help. If you could point my to a website that... (1 Reply)
I have a flat file with the following drug names
Nutropin AQ 20mg PEN Cart 2ml
Norditropin Cart 15mg/1.5ml
I have to extract digits that are before mg i.e 20 and 15 ; how to do this using regular expressions
Thanks
ram (1 Reply)
In regular expressions with grep(or egrep), ^ works if we want something in starting of line..but what if we write ^^^ or ^ for pattern matching??..Hope u all r familiar with regular expressions for pattern matching.. (1 Reply)
#!/usr/bin/perl
$word = "one last challenge";
if ( $word =~ /^(\w+).*\s(\w+)$/ )
{
print "$1";
print "\n";
print "$2";
}
The output shows that "$1" is with result one and "$2" is with result challenge. I am confused about how this pattern match expression works step by step. I... (8 Replies)
what elements does " /^/ " match?
I did the test which indicates that it matches single lowercase character like 'a','b' etc. and '1','2' etc.
But I really confused with that. Because, "/^abc/" matches strings like "abcedf" or "abcddddee".
So, what does caret ^ really mean?
Any response... (2 Replies)
I need to write a K shell script to find full file names , line numbers and lines which have words meeting either of following 2 criterias -
1)words which are 6 to 8 character long and alphanumeric.
2)Minimum 8 characters, one upper case, one lower case letter, one of the special characters... (1 Reply)
Discussion started by: Rajpreet1985
1 Replies
LEARN ABOUT CENTOS
timerisset
TIMERADD(3) Linux Programmer's Manual TIMERADD(3)NAME
timeradd, timersub, timercmp, timerclear, timerisset - timeval operations
SYNOPSIS
#include <sys/time.h>
void timeradd(struct timeval *a, struct timeval *b,
struct timeval *res);
void timersub(struct timeval *a, struct timeval *b,
struct timeval *res);
void timerclear(struct timeval *tvp);
int timerisset(struct timeval *tvp);
int timercmp(struct timeval *a, struct timeval *b, CMP);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
All functions shown above: _BSD_SOURCE
DESCRIPTION
The macros are provided to operate on timeval structures, defined in <sys/time.h> as:
struct timeval {
time_t tv_sec; /* seconds */
suseconds_t tv_usec; /* microseconds */
};
timeradd() adds the time values in a and b, and places the sum in the timeval pointed to by res. The result is normalized such that
res->tv_usec has a value in the range 0 to 999,999.
timersub() subtracts the time value in b from the time value in a, and places the result in the timeval pointed to by res. The result is
normalized such that res->tv_usec has a value in the range 0 to 999,999.
timerclear() zeros out the timeval structure pointed to by tvp, so that it represents the Epoch: 1970-01-01 00:00:00 +0000 (UTC).
timerisset() returns true (nonzero) if either field of the timeval structure pointed to by tvp contains a nonzero value.
timercmp() compares the timer values in a and b using the comparison operator CMP, and returns true (nonzero) or false (0) depending on the
result of the comparison. Some systems (but not Linux/glibc), have a broken timercmp() implementation, in which CMP of >=, <=, and == do
not work; portable applications can instead use
!timercmp(..., <)
!timercmp(..., >)
!timercmp(..., !=)
RETURN VALUE
timerisset() and timercmp() return true (nonzero) or false (0).
ERRORS
No errors are defined.
CONFORMING TO
Not in POSIX.1-2001. Present on most BSD derivatives.
SEE ALSO gettimeofday(2), time(7)COLOPHON
This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2010-02-25 TIMERADD(3)