Sponsored Content
Full Discussion: Regular expression with SED
Top Forums Shell Programming and Scripting Regular expression with SED Post 302387099 by GagleKas on Thursday 14th of January 2010 12:37:51 PM
Old 01-14-2010
Regular expression with SED

Hi!

I'm trying to write a regexp but I have no luck...

I have a string like this:

param1=sometext&param2=hello&param3=bye

Also, the string can be simply:

param2=hello

I want to return the value of param2: "hello".

How can I do this?

Thanks.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Regular expression with sed

Hi, I'm trying following:echo "test line XA24433 test" | sed 's/.*X\(.*\)/X\1/' XA24433 test While I want the output as: XA24433 I want to grab the words starting with letter X till the next space, this word can be anywhere in the line. (9 Replies)
Discussion started by: nervous
9 Replies

2. Shell Programming and Scripting

Regular expression (sed)

Hi I need to get text that are within "" For example File: asdasd "test test2" sadasds asdda asdasd "demo demo2" Output: test test2 demo demo2 Any help is good Thank you (12 Replies)
Discussion started by: blito_loco
12 Replies

3. Shell Programming and Scripting

sed regular expression help

please consider this: echo "11111*X*005010X279~ST*270*1111111*005010X279~BHT*0011*11" | sed 's/.*\(005010X(\d)(\d)(\d)*\).*$/\1/'i'm searching for first occurrence of 005010X while leaving rest of characters out. :confused: any tips? thnx in advance guys. (7 Replies)
Discussion started by: grep01
7 Replies

4. UNIX for Dummies Questions & Answers

Regular Expression In Sed

Hi , I am learing sed echo abc 123 def 456 | sed 's|\(*\) \(*\)|\1|' is returning abc def 456 i was hoping abc def "\1" should only print the occurence of the first pattern but according to my understanding it is just removing the first occurence of the second pattern... (7 Replies)
Discussion started by: max_hammer
7 Replies

5. 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

6. Shell Programming and Scripting

Help with sed regular expression

Hi all, I want to get a substring from a string based on given delimiter, for example: str="foo|bar|baz" with delimiter "|", I want to get one substring at each time with the order number the substring in the whole string, given 1 to get "foo", given 2 to get "bar", given 3 to get "baz", I... (2 Replies)
Discussion started by: Roy987
2 Replies

7. UNIX for Advanced & Expert Users

sed: -e expression #1, char 0: no previous regular expression

Hello All, I'm trying to extract the lines between two consecutive elements of an array from a file. My array looks like: problem_arr=(PRS111 PRS213 PRS234) j=0 while } ] do k=`expr $j + 1` sed -n "/${problem_arr}/,/${problem_arr}/p" problemid.txt ---some operation goes... (11 Replies)
Discussion started by: InduInduIndu
11 Replies

8. Shell Programming and Scripting

I am learning regular expression in sed,Please help me understand the use curly bracket in sed,

I am learning SED and just following the shell scripting book, i have trouble understanding the grep and sed statement, Question : 1 __________ /opt/oracle/work/antony>cat teledir.txt jai sharma 25853670 chanchal singhvi 9831545629 anil aggarwal 9830263298 shyam saksena 23217847 lalit... (7 Replies)
Discussion started by: Antony Ankrose
7 Replies

9. Shell Programming and Scripting

sed regular expression

Hi , I need to remove pipe character from a |^ delimeted file. Something like |^tran|sformers||^|revenge |of fallen|^ to |^transformers|^revenge of fallen|^... Cold anybody please help to build the regular expression using sed . many thanks. Please use code tags next time for... (1 Reply)
Discussion started by: kokjek
1 Replies
Class::Adapter::Builder(3pm)				User Contributed Perl Documentation			      Class::Adapter::Builder(3pm)

NAME
Class::Adapter::Builder - Generate Class::Adapter classes SYNOPSIS
package My::Adapter; use strict; use Class::Adapter::Builder ISA => 'Specific::API', METHODS => [ qw{foo bar baz} ], method => 'different_method'; 1; DESCRIPTION
"Class::Adapter::Builder" is another mechanism for letting you create Adapter classes of your own. It is intended to act as a toolkit for generating the guts of many varied and different types of Adapter classes. For a simple base class you can inherit from and change a specific method, see Class::Adapter::Clear. The Pragma Interface The most common method for defining Adapter classes, as shown in the synopsis, is the pragma interface. This consists of a set of key/value pairs provided when you load the module. # The format for building Adapter classes use Class::Adapter::Builder PARAM => VALUE, ... ISA The "ISA" param is provided as either a single value, or a reference to an "ARRAY" containing is list of classes. Normally this is just a straight list of classes. However, if the value for "ISA" is set to '_OBJECT_' the object will identify itself as whatever is contained in it when the "->isa" and "->can" method are called on it. NEW Normally, you need to create your "Class::Adapter" objects separately: # Create the object my $query = CGI->new( 'param1', 'param2' ); # Create the Decorator my $object = My::Adapter->new( $query ); If you provide a class name as the "NEW" param, the Decorator will do this for you, passing on any constructor arguments. # Assume we provided the following # NEW => 'CGI', # We can now do the above in one step my $object = My::Adapter->new( 'param1', 'param2' ); AUTOLOAD By default, a "Class::Adapter" does not pass on any methods, with the methods to be passed on specified explicitly with the 'METHODS' param. By setting "AUTOLOAD" to true, the "Adapter" will be given the standard "AUTOLOAD" function to to pass through all unspecified methods to the parent object. By default the AUTOLOAD will pass through any and all calls, including calls to private methods. If the AUTOLOAD is specifically set to 'PUBLIC', the AUTOLOAD setting will ONLY apply to public methods, and any private methods will not be passed through. METHODS The "METHODS" param is provided as a reference to an array of all the methods that are to be passed through to the parent object as is. Any params other than the ones specified above are taken as translated methods. # If you provide the following # foo => bar # It the following are equivalent $decorator->foo; $decorator->_OBJECT_->bar; This capability is provided primarily because in Perl one of the main situations in which you hit the limits of Perl's inheritance model is when your class needs to inherit from multiple different classes that containing clashing methods. For example: # If your class is like this package Foo; use base 'This', 'That'; 1; If both "This->method" exists and "That->method" exists, and both mean different things, then "Foo->method" becomes ambiguous. A "Class::Adapter" could be used to wrap your "Foo" object, with the "Class::Adapter" becoming the "That" sub-class, and passing "$decorator->method" through to "$object->that_method". METHODS
Yes, "Class::Adapter::Builder" has public methods and later on you will be able to access them directly, but for now they are remaining undocumented, so that I can shuffle things around for another few versions. Just stick to the pragma interface for now. SUPPORT
Bugs should be reported via the CPAN bug tracker at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Class-Adapter> For other issues, contact the author. AUTHOR
Adam Kennedy <adamk@cpan.org> SEE ALSO
Class::Adapter, Class::Adapter::Clear COPYRIGHT
Copyright 2005 - 2010 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. perl v5.10.1 2010-04-12 Class::Adapter::Builder(3pm)
All times are GMT -4. The time now is 07:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy