Sponsored Content
Full Discussion: Extract data from a string
Top Forums Shell Programming and Scripting Extract data from a string Post 302290513 by joeyg on Monday 23rd of February 2009 01:24:23 PM
Old 02-23-2009
Hammer & Screwdriver what about two awks?

Code:
> echo "<Bundle_Name>this_data</Bundle_Name>"
<Bundle_Name>this_data</Bundle_Name>
> echo "<Bundle_Name>this_data</Bundle_Name>" | awk -F">" '{print $2}' | awk -F"<" '{print $1}'
this_data

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

extract data from a find string

Can any one please lend a helping hand here? eg. find /tough -name temp1 -print After finding the location of all temp1 files. I need to extract some data( some are multiple others are just one entry) from each of the temp file. eg Order_Error{"aaaa") Order_Error("bbba") ... (2 Replies)
Discussion started by: odogbolu98
2 Replies

2. Shell Programming and Scripting

Search for string in a file and extract another string to a variable

Hi, guys. I have one question: I need to search for a string in a file, and then extract another string from the file and assign it to a variable. For example: the contents of the file (group) is below: ... ftp:x:23: mail:x:34 ... testing:x:2001 sales:x:2002 development:x:2003 ...... (6 Replies)
Discussion started by: daikeyang
6 Replies

3. Shell Programming and Scripting

extract data from a data matrix with filter criteria

Here is what old matrix look like, IDs X1 X2 Y1 Y2 10914061 -0.364613333 -0.362922333 0.001691 -0.450094667 10855062 0.845956333 0.860396667 0.014440333 1.483899333... (7 Replies)
Discussion started by: ssshen
7 Replies

4. Shell Programming and Scripting

Extract data based on match against one column data from a long list data

My input file: data_5 Ali 422 2.00E-45 102/253 140/253 24 data_3 Abu 202 60.00E-45 12/23 140/23 28 data_1 Ahmad 256 7.00E-45 120/235 140/235 22 data_4 Aman 365 8.00E-45 15/65 140/65 20 data_10 Jones 869 9.00E-45 65/253 140/253 18... (12 Replies)
Discussion started by: patrick87
12 Replies

5. Shell Programming and Scripting

Extract specific data content from a long list of data

My input: Data name: ABC001 Data length: 1000 Detail info Data Direction Start_time End_time Length 1 forward 10 100 90 1 forward 15 200 185 2 reverse 50 500 450 Data name: XFG110 Data length: 100 Detail info Data Direction Start_time End_time Length 1 forward 50 100 50 ... (11 Replies)
Discussion started by: patrick87
11 Replies

6. Shell Programming and Scripting

to extract string from main string and string comparison

continuing from my previous post, whose link is given below as a reference https://www.unix.com/shell-programming-scripting/171076-shell-scripting.html#post302573569 consider there is create table commands in a file for eg: CREATE TABLE `Blahblahblah` ( `id` int(11) NOT NULL... (2 Replies)
Discussion started by: vivek d r
2 Replies

7. Shell Programming and Scripting

Extract a string between 2 ref string from a file

Hi, May i ask if someone share some command for extracting a string between 2 ref string in a txt file My objective: i had a file with multiple lines and wants only to extract the string "watch?v=IbkAXOmEHpY" or "watch?v=<11 random character>", when i used "grep 'watch?=*' i got a results per... (4 Replies)
Discussion started by: jao_madn
4 Replies

8. Shell Programming and Scripting

Search String and extract few lines under the searched string

Need Assistance in shell programming... I have a huge file which has multiple stations and i wanted to search particular station and extract few lines from it and the rest is not needed Bold letters are the stations . The whole file has multiple stations . Below example i wanted to search... (4 Replies)
Discussion started by: ajayram_arya
4 Replies

9. Shell Programming and Scripting

To Search for a string and to extract the string from the text

Hi Team I have an huge xml where i need to search for a ceratin numbers. For example 2014-05-06 15:15:41,498 INFO WebContainer : 10 CommonServicesLogs - CleansingTriggerService.invokeCleansingService Entered PUBSUB NOTIFY MESSAGE () - <?xml version="1.0" encoding="UTF-8"... (5 Replies)
Discussion started by: Kannannair
5 Replies

10. Shell Programming and Scripting

How to extract every repeated string between two specific string?

Hello guys, I have problem with hpux shell script. I have one big text file that contains like SOH bla bla bla bla bla bla ETX SOH bla bla bla ETX SOH bla bla bla ETX What I need to do is save first SOH*BLA into file1.txt, save second SOH*BLA into file2.txt and so on.... (17 Replies)
Discussion started by: sembii
17 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 VERSION
version 0.99 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-2013 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. AUTHORS
o Clinton Gormley <drtech@cpan.org> o Audrey Tang <cpan@audreyt.org> COPYRIGHT AND LICENSE
This software is Copyright (c) 2014 by Audrey Tang. This is free software, licensed under: The MIT (X11) License perl v5.18.2 2014-02-03 Locale::Maketext::Extract::Plugin::Base(3)
All times are GMT -4. The time now is 01:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy