bipinajith's proposal works as long as all of the allele= and alleles= entries are in the 2nd field in the input lines, and all of the allele= entries come after the alleles= entry, except that it doesn't put the requested "/" between allele= entries when more than one is present. It also provides an extra leading newline that wasn't requested.
The following should work as requested no matter what order they are in nor which fields contain allele and alleles entries even if multiple entries appear on the same line. It will also print multiple alleles= entries if they occur using a comma to separate subsequent occurrences:
As always, if you're using a Solaris system, use /usr/xpg4/bin/awk or nawk instead of awk.
This User Gave Thanks to Don Cragun For This Post:
Hi
I want to extract certain text between two line numbers like
23234234324 and
54446655567567
How do I do this with a simple sed or awk command?
Thank you.
---------- Post updated at 06:16 PM ---------- Previous update was at 05:55 PM ----------
found it:
sed -n '#1,#2p'... (1 Reply)
Hi,
I got a long list of contents:
>sequence_1
ASSSSSSSSSSSDDDDDDDDDDDCCCCCCC
ASDSFDFFDFDFFWERERERERFSDFESFSFD
>sequence_2
ASDFDFDFFDDFFDFDSFDSFDFSDFSDFDSFASDSADSADASD
ASDFFDFDFASFASFASFAFSFFSDASFASFASFAFS
>sequence_3
VEDFGSDGSDGSDGSDGSDGSDGSDG
dDFSDFSDFSDFSDFSDFSDFSDFSDF... (2 Replies)
Hi,
I need to extract <APPNUMBER> tag alone, if the <college> haas IIT Chennai value. college tag value will have spaces embedded. Those spaces should not be suppresses.
My Source file
<Record><sno>1</sno><empid>E0001</empid><name>Rejsh suderam</name><college>IIT ... (3 Replies)
Hello,
I'm trying to code a bash script and I was wondering how to extract a specific line from a stream.
E.g.
My file "file" contains three lines and i'd like to find a function f which returns after execution a specific line like the second line, which would be :
f(file, 2) = Second... (4 Replies)
Hi guys,
I have txt file and I would need to extract all the contents between specific line numbers.
Line 1: apple
Line 2: orange
Line 3: mango
Line 4: grapes
Line 5: pine apple
I need to extract the content between line 2 and 4, including the contents of Line 2 and 4 so the ouput... (2 Replies)
Say the input was as follows:
Brat 20 x 1000 32rf
Pour 15 p 1621 05pr
Dart 10 z 1111 22xx
My program prompts for an input, what I want is to use the input to locate a specific field. Like if I type in, "Pou" then it would return "Pour" and just "Pour"
I currently have this line but it is... (6 Replies)
Hi All,
I'm trying to figure out which are the trusted-ips and which are not using a script file.. I have a file named 'ip-list.txt' which contains some ip addresses and another file named 'trusted-ip-list.txt' which also contains some ip addresses. I want to read a line from... (4 Replies)
Hi guys,
I have been trying to do this, but... no luck so maybe you can help me.
I have a line like this:
Total Handled, Received, on queue Input Mgs: 140 / 14 => 0
I need to, get the number after the / until the =, to get only 14 .
Any help is greatly appreciated.
Thanks, (4 Replies)
Hi, I am trying to use an awk command to replace specific character positions on a line beginning with 80 with contents of another file.
The line beginning with 80 in file1 is as follows:
I want to replace the 000000000178800 (positions 34 - 49) on this file with the contents of... (2 Replies)
Hi
This is my first post and I'm just a beginner. So please be nice to me.
I have a couple of html files where a pattern beginning with "http://www.site.com" and ending with "/resource.dat" is present on every 241st line. How do I extract this to a new text file?
I have tried sed -n 241,241p... (13 Replies)
Discussion started by: dejavo
13 Replies
LEARN ABOUT DEBIAN
locale::maketext::extract::plugin::base
Locale::Maketext::Extract::Plugin::Base(3pm) User Contributed Perl Documentation Locale::Maketext::Extract::Plugin::Base(3pm)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.14.2 2011-03-02 Locale::Maketext::Extract::Plugin::Base(3pm)