Sponsored Content
Top Forums Shell Programming and Scripting Extract multiple entries between pattern Post 302353882 by fbc1007 on Wednesday 16th of September 2009 12:05:30 PM
Old 09-16-2009
Extract multiple entries between pattern

Hi Gurus,

Is there a way to extract multiple entries from one line?

For example, consider the line below,

Code:
Entity Action="Update" Type="Person" TradingPartnerId=""  Status="Failure"

I'm interested only on text between doublecotes "". So, my output sould be something like,

Code:
Update - Person - - Failure

TIA

Last edited by vgersh99; 09-16-2009 at 01:13 PM.. Reason: code tags, PLEASE!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Extract the Pattern

Hello All, can anyone help me out in extracting the pattern from a file... The Input file is: NFS B.11.11 ONC/NFS; Network-FileSystem,InformationServices,Utilities|123 NParProvider B.11.11.01.04.01.01 nPartition Provider|456 NPartition A.01.02 Enhanced NPartition Commands/789... (6 Replies)
Discussion started by: aajan
6 Replies

2. Shell Programming and Scripting

pattern extract

Hi I have a pattern like : SYSTEM_NAME-232-S7-200810060949.LOG Here I need to extract system name and the timestamp and also the numeric number after "-S" i.e 7 here . I am not very sure of whether I should use sed / awk for this ?:confused: Thanks, Priya. (6 Replies)
Discussion started by: priyam
6 Replies

3. Shell Programming and Scripting

sed: Find start of pattern and extract text to end of line, including the pattern

This is my first post, please be nice. I have tried to google and read different tutorials. The task at hand is: Input file input.txt (example) abc123defhij-E-1234jslo 456ujs-W-abXjklp From this file the task is to grep the -E- and -W- strings that are unique and write a new file... (5 Replies)
Discussion started by: TestTomas
5 Replies

4. Shell Programming and Scripting

extract multiple cloumns from multiple files; skip rows and include filenames; awk

Hello, I am trying to write a bash shell script that does the following: 1.Finds all *.txt files within my directory of interest 2. reads each of the files (25 files) one by one (tab-delimited format and have the same data format) 3. skips the first 10 rows of the file 4. extracts and... (4 Replies)
Discussion started by: manishabh
4 Replies

5. Shell Programming and Scripting

need help with post:extract multiple columns from multiple files

hello, I will would be grateful if anyone can help me reply to my post extract multiple cloumns from multiple files; skip rows and include filenames; awk Please see this thread. Thanks manishabh (0 Replies)
Discussion started by: manishabh
0 Replies

6. Shell Programming and Scripting

Search for a pattern,extract value(s) from next line, extract lines having those extracted value(s)

I have hundreds of files to process. In each file I need to look for a pattern then extract value(s) from next line and then search for value(s) selected from point (2) in the same file at a specific position. HEADER ELECTRON TRANSPORT 18-MAR-98 1A7V TITLE CYTOCHROME... (7 Replies)
Discussion started by: AshwaniSharma09
7 Replies

7. Shell Programming and Scripting

Extract a pattern from multiple lines in a file

I have a file that has some lines starts with * I want to get these lines, then get the word between "diac" and "lex". ex. file: ;;WORD AlAx *0.942490 diac:Al>ax lex:>ax_1 bw:Al/DET+>ax/NOUN+ gloss:brother pos:noun prc3:0 prc2:0 prc1:0 prc0:Al_det per:na asp:na vox:na mod:na gen:m num:s... (4 Replies)
Discussion started by: Viernes
4 Replies

8. Shell Programming and Scripting

Need pattern Extract

2014-05-31-18.22.18.500158-240 E11115478A502 LEVEL: Info PID : 25100668 TID : 73282 PROC : db2sysc 0 INSTANCE: udbin001 NODE : 000 DB : APPHDL : 0-18345 APPID: *LOCAL.udbin001.140531200018 AUTHID : udbin001 EDUID : 73282 ... (4 Replies)
Discussion started by: ilugopal
4 Replies

9. Shell Programming and Scripting

Match Pattern and print pattern and multiple lines into one line

Hello Experts , require help . See below output: File inputs ------------------------------------------ Server Host = mike id rl images allocated last updated density vimages expiration last read <------- STATUS ------->... (4 Replies)
Discussion started by: tigerhills
4 Replies

10. Shell Programming and Scripting

Extract whole word preceding a specific character pattern with first occurence of the pattern

Hello. Here is a file contents : declare -Ax NEW_FORCE_IGNORE_ARRAY=(="§" ="§" ="§" ="§" ="§" .................. ="§"Here is a pattern =I want to extract 'NEW_FORCE_IGNORE_ARRAY' which is the whole word before the first occurrence of pattern '=' Is there a better solution than mine :... (3 Replies)
Discussion started by: jcdole
3 Replies
Locale::Maketext::Extract::Plugin::Base(3)		User Contributed Perl Documentation		Locale::Maketext::Extract::Plugin::Base(3)

NAME
Locale::Maketext::Extract::Plugin::Base - Base module for format parser plugins SYNOPSIS
package My::Parser::Plugin; use base qw(Locale::Maketext::Extract::Plugin::Base); sub file_types { return [qw( ext ext2 )] } sub extract { my $self = shift; local $_ = shift; my $line = 1; while (my $found = $self->routine_to_extract_strings) { $self->add_entry($str,[$filename,$line,$vars]) } return; } DESCRIPTION
All format parser plugins in Locale::Maketext::Extract inherit from Locale::Maketext::Extract::Plugin::Base. If you want to write your own custom parser plugin, you will need to inherit from this module, and provide "file_types()" and "extract()" methods, as shown above. METHODS
new() $plugin = My::Parser->new( @file_types # Optionally specify a list of recognised file types ) add_entry() $plugin->add_entry($str,$line,$vars) "entries()" $entries = $plugin->entries; "clear()" $plugin->clear Clears all stored entries. file_types() @default_file_types = $plugin->file_types Returns a list of recognised file types that your module knows how to parse. Each file type can be one of: o A plain string 'pl' => base filename is matched against qr/.pl$/ '*' => all files are accepted o A regex qr/.tt2?./ => base filename is matched against this regex o A codref sub {} => this codref is called as $coderef->($base_filename,$path_to_file) It should return true or false extract() $plugin->extract($filecontents); extract() is the method that will be called to process the contents of the current file. When it finds a string that should be extracted, it should call $self->add_entry($string,$line,$vars]) where $vars refers to any arguments that are being passed to the localise function. For instance: l("You found [quant,_1,file,files]",files_found) string: "You found [quant,_1,file,files]" vars : (files_found) IMPORTANT: a single plugin instance is used for all files, so if you plan on storing state information in the $plugin object, this should be cleared out at the beginning of "extract()" known_file_type() if ($plugin->known_file_type($filename_with_path)) { .... } Determines whether the current file should be handled by this parser, based either on the list of file_types specified when this object was created, or the default file_types specified in the module. SEE ALSO
xgettext.pl for extracting translatable strings from common template systems and perl source files. Locale::Maketext::Lexicon Locale::Maketext::Extract::Plugin::Perl Locale::Maketext::Extract::Plugin::PPI Locale::Maketext::Extract::Plugin::TT2 Locale::Maketext::Extract::Plugin::YAML Locale::Maketext::Extract::Plugin::FormFu Locale::Maketext::Extract::Plugin::Mason Locale::Maketext::Extract::Plugin::TextTemplate Locale::Maketext::Extract::Plugin::Generic AUTHORS
Clinton Gormley [DRTECH] <clinton@traveljury.com> COPYRIGHT
Copyright 2002-2008 by Audrey Tang <cpan@audreyt.org>. This software is released under the MIT license cited below. The "MIT" License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. perl v5.16.2 2011-03-02 Locale::Maketext::Extract::Plugin::Base(3)
All times are GMT -4. The time now is 10:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy