Sponsored Content
Full Discussion: Reg expression For
Top Forums Shell Programming and Scripting Reg expression For Post 302192446 by Annihilannic on Wednesday 7th of May 2008 01:35:47 AM
Old 05-07-2008
Something like this?

Code:
$date="system.sysUpTime.0 : Timeticks: (1519411311) 175 days, 20:35:13.11";
$date=~ s/.* (\d+) days.*/$1/;

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awk - Using a Shell Variable in the Reg Expression

Hi all, I have a shell variable $test1 that holds a value derived from some other processing. What I need to do is use that $test1 as the input to a awk regular expression: nawk -F"," -v tester=$test1 ' /tester/{ print $0 } ' $inputFile So what I have is tester... (6 Replies)
Discussion started by: not4google
6 Replies

2. UNIX for Dummies Questions & Answers

Help with Reg. Expression

I need help with this: Can any one tell me what does these below mean: 1. "\(.\).*") != '/' 2. sed 's+^\./++;s+/.*++' 3. sed "s+${f}/+ + Thanks in advance (7 Replies)
Discussion started by: moe2266
7 Replies

3. Shell Programming and Scripting

perl reg expression

I have regular expression like this ( replace + with \+) ($mod_server) = ($server =~ /\+/\\+/g); the above is failing with error . what's wrong with it . Thanks (1 Reply)
Discussion started by: talashil
1 Replies

4. Shell Programming and Scripting

Python (startswith) reg expression

Hello together, Yesterday I have recieved the script in the forum which works well. This script should insert in the previous line, the line that starts with ";". I'd like this process to recur after any arbitrary sign unless there's a number as a sign at the beginning of a line. Actual... (14 Replies)
Discussion started by: research3
14 Replies

5. Shell Programming and Scripting

awk reg expression

Hello, I have thousand of messages (HL7), I want to use awk to extract only the ones that have a particular value in pv1.18 Each record in the file is the whole HL7 message, ie. when I print $0 I get the whole message MSH EVN PID etc. ,there is an x0d between the segments. I would like to use a... (3 Replies)
Discussion started by: gio001
3 Replies

6. Shell Programming and Scripting

Reg expression

Please let me understand this reg expression (\s+')(.*)('\s+)(.)(.*)(\/.*)/) i have doubt in the below 2.I'm not understanding why back-tick used? (\s+') and ('\s+) (2 Replies)
Discussion started by: dll_fpga
2 Replies

7. Shell Programming and Scripting

reg expression in perl

./GEN_SCR.pl -f ${REP_PATH}/FUNCTIONAL/wide1c_1.0V/max/qor.rpt -o ${REP_PATH}/FUNCTIONAL/GEN2_wide1c_1.0V_max.csv where GEN_SCR.pl is as below...i need to check whether max or min is coming in the argument to the script ...how to do this? ${REP_PATH}/FUNCTIONAL/wide1c_1.0V/max/qor.rpt ... (0 Replies)
Discussion started by: dll_fpga
0 Replies

8. Shell Programming and Scripting

reg expression in perl

how to uniquely match each of the words seperated by / in perl ${REP_PATH}/FUNCTIONAL/wide1c_1.0V/max/qor.rpt https://www.unix.com/images/misc/progress.gif (5 Replies)
Discussion started by: dll_fpga
5 Replies

9. Shell Programming and Scripting

Confusion with Reg expression

I want to make a REG Expression to validate the directory. my dirsample is below: /abc/abc/abc abc/abc/abc abc/abc/abc/ /abc/a bc/abc /a bc/abc/abc /abc/abc/a bc / abc/abc/abc /abc/ abc/abc /abc/.abc /.abc/abc / // /abc /.abc And my code is below: grep -E '^\/(+\/?)+$' dirsample (4 Replies)
Discussion started by: franksunnn
4 Replies

10. Shell Programming and Scripting

REG Expression

Need your help in creating regular expression for particular set. let say I have given two dates 20130623 to 20140625. I need to create regular for the dates which fall in between above two dates. (4 Replies)
Discussion started by: gvkumar25
4 Replies
re(3pm) 						 Perl Programmers Reference Guide						   re(3pm)

NAME
re - Perl pragma to alter regular expression behaviour SYNOPSIS
use re 'taint'; ($x) = ($^X =~ /^(.*)$/s); # $x is tainted here $pat = '(?{ $foo = 1 })'; use re 'eval'; /foo${pat}bar/; # won't fail (when not under -T switch) { no re 'taint'; # the default ($x) = ($^X =~ /^(.*)$/s); # $x is not tainted here no re 'eval'; # the default /foo${pat}bar/; # disallowed (with or without -T switch) } use re 'debug'; # NOT lexically scoped (as others are) /^(.*)$/s; # output debugging info during # compile and run time use re 'debugcolor'; # same as 'debug', but with colored output ... (We use $^X in these examples because it's tainted by default.) DESCRIPTION
When "use re 'taint'" is in effect, and a tainted string is the target of a regex, the regex memories (or values returned by the m// opera- tor in list context) are tainted. This feature is useful when regex operations on tainted data aren't meant to extract safe substrings, but to perform other transformations. When "use re 'eval'" is in effect, a regex is allowed to contain "(?{ ... })" zero-width assertions even if regular expression contains variable interpolation. That is normally disallowed, since it is a potential security risk. Note that this pragma is ignored when the regular expression is obtained from tainted data, i.e. evaluation is always disallowed with tainted regular expresssions. See "(?{ code })" in perlre. For the purpose of this pragma, interpolation of precompiled regular expressions (i.e., the result of "qr//") is not considered variable interpolation. Thus: /foo${pat}bar/ is allowed if $pat is a precompiled regular expression, even if $pat contains "(?{ ... })" assertions. When "use re 'debug'" is in effect, perl emits debugging messages when compiling and using regular expressions. The output is the same as that obtained by running a "-DDEBUGGING"-enabled perl interpreter with the -Dr switch. It may be quite voluminous depending on the complex- ity of the match. Using "debugcolor" instead of "debug" enables a form of output that can be used to get a colorful display on terminals that understand termcap color sequences. Set $ENV{PERL_RE_TC} to a comma-separated list of "termcap" properties to use for highlighting strings on/off, pre-point part on/off. See "Debugging regular expressions" in perldebug for additional info. The directive "use re 'debug'" is not lexically scoped, as the other directives are. It has both compile-time and run-time effects. See "Pragmatic Modules" in perlmodlib. perl v5.8.0 2002-06-01 re(3pm)
All times are GMT -4. The time now is 04:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy