Sponsored Content
Top Forums Shell Programming and Scripting Regular expression query in AWK Post 302075568 by Klashxx on Monday 5th of June 2006 09:07:56 AM
Old 06-05-2006
Try:
Code:
echo "${string}"|awk '/After Executing service For .* Request/ {VAL=$5;print VAL}'

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Regular expression query in AWK

I have a varable(var1) in a AWK script that contain data in the following format - I need to extract timestamp,priority and log message.I can extract these by using split function but i don't want to use it, since i want to extract it in one go. I have some difficulties in doing it using... (3 Replies)
Discussion started by: omprasad
3 Replies

2. Shell Programming and Scripting

awk and regular expression

Ive got a file with words and also numbers. Bla BLA 10 10 11 29 12 89 13 35 And i need to change "10,29,89,25" and also remove anything that contains actually words... (4 Replies)
Discussion started by: maskot
4 Replies

3. UNIX for Dummies Questions & Answers

regular expression and awk

I can print a line with an expression using this: awk '/regex/' I can print the line immediately before an expression using this: awk '/regex/{print x};{x=$0}' How do I print the line immediately before and then the line with the expression? (2 Replies)
Discussion started by: nickg
2 Replies

4. Shell Programming and Scripting

need help guys for Regular expression in awk

Hello Experts, Please help me to cope with the following problem I ve patterens like Input Noptx(5) // remain the same -*Nop(3); Nop(9); --Nop(8); // remain the same d3 **---Nop(7); //remain the same d3 **---Nop(7); *--Nop(6); --**Nop(5); -Nop(4); Nop(3); - represents a space... (2 Replies)
Discussion started by: user_prady
2 Replies

5. Shell Programming and Scripting

Awk's variable in regular expression

Anyone know how I will use awk's variable in a regular expression? This line of code of mine is working, the value PREMS should be a variable: awk '$1 ~ /PREMS/ { if(length(appldata)+2 >= length($1)) print $0; }' appldata=$APPLDATA /tmp/file.tmp The value of APPLDATA variable is PREMS. ... (2 Replies)
Discussion started by: Orbix
2 Replies

6. Shell Programming and Scripting

Query Regarding Regular Expression

Can you please tell me the meaning of .* For eg. i have a text as "Scrapple the apple" Now here, what does a.*e will match? (7 Replies)
Discussion started by: Shell_Learner
7 Replies

7. Shell Programming and Scripting

Regular expression in AWK

Hello world, I was wondering if there is a nicer way to write the following code (in AWK): awk ' FNR==NR&&$1~/^m$/{tok1=1} FNR==NR&&$1~/^m10$/{tok1=1} ' my_file In fact, it looks for m2, m4, m6, m8 and m10 and then return a positive flag. The problem is how to define 10 thanks... (3 Replies)
Discussion started by: jolecanard
3 Replies

8. Programming

Perl: How to read from a file, do regular expression and then replace the found regular expression

Hi all, How am I read a file, find the match regular expression and overwrite to the same files. open DESTINATION_FILE, "<tmptravl.dat" or die "tmptravl.dat"; open NEW_DESTINATION_FILE, ">new_tmptravl.dat" or die "new_tmptravl.dat"; while (<DESTINATION_FILE>) { # print... (1 Reply)
Discussion started by: jessy83
1 Replies

9. Shell Programming and Scripting

awk regular expression

Hello, I have big files which I wanna filter them based on first column. first column should be one of these strings: chr2L || chr2R || chr3L || chr3R || chr4 || chrX and something like chr2Lh or chrY or chrM3L is not accepted. I used the following command: awk '{ if ($1=="chr2L" ||... (5 Replies)
Discussion started by: @man
5 Replies

10. Shell Programming and Scripting

awk regular expression search

Hi All, I would like to search a regular expression by passing as an i/p variableto AWK. For Example :: 162.111.101.209.9516 162.111.101.209.41891 162.111.101.209.9516 162.111.101.209.9517 162.111.101.209.41918 162.111.101.209.9517 162.111.101.209.41937 162.111.101.209.41951... (7 Replies)
Discussion started by: Girish19
7 Replies
UNIVERSAL(3pm)						 Perl Programmers Reference Guide					    UNIVERSAL(3pm)

NAME
UNIVERSAL - base class for ALL classes (blessed references) SYNOPSIS
$is_io = $fd->isa("IO::Handle"); $is_io = Class->isa("IO::Handle"); $sub = $obj->can("print"); $sub = Class->can("print"); use UNIVERSAL qw( isa can VERSION ); $yes = isa $ref, "HASH" ; $sub = can $ref, "fandango" ; $ver = VERSION $obj ; DESCRIPTION
"UNIVERSAL" is the base class which all bless references will inherit from, see perlobj. "UNIVERSAL" provides the following methods and functions: $obj->isa( TYPE ), CLASS->isa( TYPE ), isa( VAL, TYPE ) C<TYPE> is a package name $obj is a blessed reference or a string containing a package name C<CLASS> is a package name C<VAL> is any of the above or an unblessed reference When used as an instance or class method ("$obj-"isa( TYPE )>), "isa" returns true if $obj is blessed into package "TYPE" or inherits from package "TYPE". When used as a class method ("CLASS-"isa( TYPE )>; sometimes referred to as a static method), "isa" returns true if "CLASS" inherits from (or is itself) the name of the package "TYPE" or inherits from package "TYPE". When used as a function, like use UNIVERSAL qw( isa ) ; $yes = isa $h, "HASH"; $yes = isa "Foo", "Bar"; or require UNIVERSAL ; $yes = UNIVERSAL::isa $a, "ARRAY"; , "isa" returns true in the same cases as above and also if "VAL" is an unblessed reference to a perl variable of type "TYPE", such as "HASH", "ARRAY", or "Regexp". $obj->can( METHOD ), CLASS->can( METHOD ), can( VAL, METHOD ) "can" checks if the object or class has a method called "METHOD". If it does then a reference to the sub is returned. If it does not then undef is returned. This includes methods inherited or imported by $obj, "CLASS", or "VAL". "can" cannot know whether an object will be able to provide a method through AUTOLOAD, so a return value of undef does not necessarily mean the object will not be able to handle the method call. To get around this some module authors use a forward declaration (see perl- sub) for methods they will handle via AUTOLOAD. For such 'dummy' subs, "can" will still return a code reference, which, when called, will fall through to the AUTOLOAD. If no suitable AUTOLOAD is provided, calling the coderef will cause an error. "can" can be called as a class (static) method, an object method, or a function. When used as a function, if "VAL" is a blessed reference or package name which has a method called "METHOD", "can" returns a reference to the subroutine. If "VAL" is not a blessed reference, or if it does not have a method "METHOD", undef is returned. VERSION ( [ REQUIRE ] ) "VERSION" will return the value of the variable $VERSION in the package the object is blessed into. If "REQUIRE" is given then it will do a comparison and die if the package version is not greater than or equal to "REQUIRE". "VERSION" can be called as either a class (static) method, an object method or or a function. These subroutines should not be imported via "use UNIVERSAL qw(...)". If you want simple local access to them you can do *isa = &UNIVERSAL::isa; to import isa into your package. perl v5.8.0 2002-06-01 UNIVERSAL(3pm)
All times are GMT -4. The time now is 01:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy