Sponsored Content
Top Forums Shell Programming and Scripting Extracting a string from a line Post 302763849 by Ashish Rathour on Wednesday 30th of January 2013 02:32:27 PM
Old 01-30-2013
100 % sure this will solve ur proble , check this
Code:
cat file |awk -F ">" '{print $4}' |awk -F "<" '{print $1}'


Last edited by Franklin52; 01-31-2013 at 03:53 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

extracting from a string

How do I extract 5th to 10th characters of string as given below stored in a shell variable. "ab cd ef gh ij kl" How is cut to be used on this? Thanks for any help. (1 Reply)
Discussion started by: preetikate
1 Replies

2. Shell Programming and Scripting

Extracting a string from one file and searching the same string in other files

Hi, Need to extract a string from one file and search the same in other files. Ex: I have file1 of hundred lines with no delimiters not even space. I have 3 more files. I should get 1 to 10 characters say substring from each line of file1 and search that string in rest of the files and get... (1 Reply)
Discussion started by: mohancrr
1 Replies

3. Shell Programming and Scripting

extracting a line based on line number

i want to cut all the entries from the /etc/passwd file in which the uid is> 500 for this i was writing this ,m quiet new to all this.. scripting but on the 6th n 8th line ,, i hav to specify a line number .. to get the commnd working .. but i want to use variable i instead of that ,,... (2 Replies)
Discussion started by: narendra.pant
2 Replies

4. Shell Programming and Scripting

extracting a string

Hi All, I am writing a shell script for which I am stuck with an extraction part. I arrived till extraction of a path of file. Lets take an example. I now have a file which contains following one line: 2348/home/userid/mydir/any_num_dir/myfile.text Now I want to extract only... (2 Replies)
Discussion started by: start_shell
2 Replies

5. Shell Programming and Scripting

Extracting String

I am trying to extract a hyperlink from a html document using awk. I have managed to output in the format... href="index.html"> where i would like it just to output index.html. Any ideas on how i would do this? Thanks (2 Replies)
Discussion started by: adpe
2 Replies

6. Shell Programming and Scripting

Extracting particular string in a file and storing matched string in output file

Hi , I have input file and i want to extract below strings <msisdn xmlns="">0492001956</ msisdn> => numaber inside brackets <resCode>3000</resCode> => 3000 needs to be extracted <resMessage>Request time getBalances_PSM.c(37): d out</resMessage></ns2:getBalancesResponse> => the word... (14 Replies)
Discussion started by: sushmab82
14 Replies

7. Shell Programming and Scripting

Extracting a string matching a pattern from a line

Hi All, I am pretty new to pattern matching and extraction using shell scripting. Could anyone please help me in extracting the word matching a pattern from a line in bash. Input Sample (can vary between any of the 3 samples below): 1) Adaptec SCSI RAID 5445 2) Adaptec SCSI 5445S RAID 3)... (8 Replies)
Discussion started by: jharish
8 Replies

8. Red Hat

How to add a new string at the end of line by searching a string on the same line?

Hi, I have a file which is an extract of jil codes of all autosys jobs in our server. Sample jil code: ************************** permission:gx,wx date_conditions:yes days_of_week:all start_times:"05:00" condition: notrunning(appDev#box#ProductLoad)... (1 Reply)
Discussion started by: raghavendra
1 Replies

9. Shell Programming and Scripting

Extracting the part of string

I have a string: 2015-04-16 07:30:05,625000 +0900 xxxx.com I just want to extract the time from the above line I am using the below syntax x=~ /(.*) (\d+)\:(\d+)\:(\d+),(.*)\.com/ $time = $2 . ':' . $3 . ':' . $4; print $time But it is not working. Can some1 please help (2 Replies)
Discussion started by: karan8810
2 Replies

10. Shell Programming and Scripting

Extracting substring within string between 2 token within the string

Hello. First best wishes for everybody. here is the input file ("$INPUT1") contents : BASH_FUNC_message_begin_script%%=() { local -a L_ARRAY; BASH_FUNC_message_debug%%=() { local -a L_ARRAY; BASH_FUNC_message_end_script%%=() { local -a L_ARRAY; BASH_FUNC_message_error%%=() { local... (3 Replies)
Discussion started by: jcdole
3 Replies
PARL(1) 						User Contributed Perl Documentation						   PARL(1)

NAME
parl - Binary PAR Loader SYNOPSIS
(Please see pp for convenient ways to make self-contained executables, scripts or PAR archives from perl programs.) To make a PAR distribution from a CPAN module distribution: % parl -p # make a PAR dist under the current path % parl -p Foo-0.01 # assume unpacked CPAN dist in Foo-0.01/ To manipulate a PAR distribution: % parl -i Foo-0.01-i386-freebsd-5.8.0.par # install % parl -i http://foo.com/Foo-0.01 # auto-appends archname + perlver % parl -i cpan://AUTRIJUS/PAR-0.74 # uses CPAN author directory % parl -u Foo-0.01-i386-freebsd-5.8.0.par # uninstall % parl -s Foo-0.01-i386-freebsd-5.8.0.par # sign % parl -v Foo-0.01-i386-freebsd-5.8.0.par # verify To use Hello.pm from ./foo.par: % parl -A./foo.par -MHello % parl -A./foo -MHello # the .par part is optional Same thing, but search foo.par in the @INC; % parl -Ifoo.par -MHello % parl -Ifoo -MHello # ditto Run test.pl or script/test.pl from foo.par: % parl foo.par test.pl # looks for 'main.pl' by default, # otherwise run 'test.pl' To make a self-containing executable containing a PAR file : % parl -O./foo foo.par % ./foo test.pl # same as above To embed the necessary non-core modules and shared objects for PAR's execution (like "Zlib", "IO", "Cwd", etc), use the -b flag: % parl -b -O./foo foo.par % ./foo test.pl # runs anywhere with core modules installed If you also wish to embed core modules along, use the -B flag instead: % parl -B -O./foo foo.par % ./foo test.pl # runs anywhere with the perl interpreter This is particularly useful when making stand-alone binary executables; see pp for details. DESCRIPTION
This stand-alone command offers roughly the same feature as "perl -MPAR", except that it takes the pre-loaded .par files via "-Afoo.par" instead of "-MPAR=foo.par". Additionally, it lets you convert a CPAN distribution to a PAR distribution, as well as manipulate such distributions. For more information about PAR distributions, see PAR::Dist. You can use it to run .par files: # runs script/run.pl in archive, uses its lib/* as libraries % parl myapp.par run.pl # runs run.pl or script/run.pl in myapp.par % parl otherapp.pl # also runs normal perl scripts However, if the .par archive contains either main.pl or script/main.pl, it is used instead: % parl myapp.par run.pl # runs main.pl, with 'run.pl' as @ARGV Finally, the "-O" option makes a stand-alone binary executable from a PAR file: % parl -B -Omyapp myapp.par % ./myapp # run it anywhere without perl binaries With the "--par-options" flag, generated binaries can act as "parl" to pack new binaries: % ./myapp --par-options -Omyap2 myapp.par # identical to ./myapp % ./myapp --par-options -Omyap3 myap3.par # now with different PAR For an explanation of stand-alone executable format, please see par.pl. SEE ALSO
PAR, PAR::Dist, par.pl, pp AUTHORS
Audrey Tang <cpan@audreyt.org> <http://par.perl.org/> is the official PAR website. You can write to the mailing list at <par@perl.org>, or send an empty mail to <par-subscribe@perl.org> to participate in the discussion. Please submit bug reports to <bug-par@rt.cpan.org>. COPYRIGHT
Copyright 2002-2009 by Audrey Tang <cpan@audreyt.org>. Neither this program nor the associated pp program impose any licensing restrictions on files generated by their execution, in accordance with the 8th article of the Artistic License: "Aggregation of this Package with a commercial distribution is always permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution. Such use shall not be construed as a distribution of this Package." Therefore, you are absolutely free to place any license on the resulting executable, as long as the packed 3rd-party libraries are also available under the Artistic License. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See <http://www.perl.com/perl/misc/Artistic.html> perl v5.18.2 2012-01-06 PARL(1)
All times are GMT -4. The time now is 06:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy