10-12-2012
Hi Guru,
Thanks for the code - It does 90% of what I want:
The text it is lanalysing looks like this:
+=========================>>
Some stuff that evreryone should knnow
other stufsjdokajkajokajda
aijhjajcdjajcisajc
<<=========================+
+=========================>>
Some stuff that evreryone should knnow
other stufsjdokajkajokajda
aijhjajcdjajcisajcqsqdqwdqad
<<=========================+
And the output is:
+=========================>>
Some stuff that evreryone should knnow
other stufsjdokajkajokajda
aijhjajcdjajcisajc
<<=========================+
+=========================>>
Some stuff that evreryone should knnow
other stufsjdokajkajokajda
aijhjajcdjajcisajcqsqdqwdqad
How can I get it to output only the text between the ">>" and "<<" strings?
Thanks again.
M
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
i have textfiles that contain a series of lines that look like this:
string0 .................................................... column3a column4a
string1**384y0439 ..................................... column3b column4b... (2 Replies)
Discussion started by: Deanne
2 Replies
2. Shell Programming and Scripting
There are a lot of ways to extract text from between two strings, but what if those strings occur multiple times and you only want the text from the first two strings? I can't seem to find anything to work here. I'm using sed to process the text after it's extracted, so I prefer a sed answer, but... (4 Replies)
Discussion started by: fubaya
4 Replies
3. Shell Programming and Scripting
Hi,
I've looked at a few existing posts on this, but they don't seem to work for my inputs.
I have a text file where I want to extract all the text between two strings, every time that occurs.
Eg my input file is
Anna said that she would fetch the bucket.
Anna and Ben moved the bucket.... (9 Replies)
Discussion started by: JamesForeman
9 Replies
4. Programming
Hello. This shouldn't be an unusual problem, but I cannot find anything about it at google or at other search machine.
So, I've made an application using C++ and QtCreator. I 've made a new mime type for application's project files.
My system (ubuntu 10.10), when I right click a file and I... (3 Replies)
Discussion started by: hakermania
3 Replies
5. Shell Programming and Scripting
Hi All,
I have a file whose common patter is like this:
.I 1
.U
87049087
.S
Some text here too
.M
This is a text
.T
Some another text here
.P
Name of the book
.W
Some lines of more text. This text needs to be extracted.
.A
more text goes here too
.I 2 (2 Replies)
Discussion started by: shoaibjameel123
2 Replies
6. Shell Programming and Scripting
Hello. I am sorry if this is a common question but through all my searching, I haven't found an answer which matches what I want to do.
I am looking for a sed command that will parse through a large text file and extract lines that start with specific words (which are repeated throughout the... (4 Replies)
Discussion started by: MrDumbQuestion
4 Replies
7. UNIX for Dummies Questions & Answers
Here is my task, I feel sure this can be accomplished with see/awk but can't seem to figure out how.
I have large flat file from which I need to extract every case of a pairing of characters (GG) in this case PLUS the previous 20 characters. The output should be a list (which I plan to make... (17 Replies)
Discussion started by: Twinklefingers
17 Replies
8. Shell Programming and Scripting
Dear All,
I have to solve the following problems with multiple tab-separated text file but I don't know how. Any help would be greatly appreciated. I have access to Linux mint (but not as a professional).
I have multiple tab-delimited files with the following structure:
file1:
1 44
2 ... (5 Replies)
Discussion started by: Bastami
5 Replies
9. Shell Programming and Scripting
I need to get text between two strings <app-deployment file=" and </app-deployment> as it appears more than once in the file then how can i store the text between each occurrence in a separate file ?
Thus, i need the below to go in found1.tmp
and the below to go in found2.tmp
... (8 Replies)
Discussion started by: mohtashims
8 Replies
10. UNIX for Beginners Questions & Answers
Hi Team -
I hope everyone has been well!
I export a file from one of our source systems that gives me more information than I need. The way the file outputs, I need to extract certain strings at different positions on the file and echo them to another file.
I can do this in batch easily,... (2 Replies)
Discussion started by: SIMMS7400
2 Replies
LEARN ABOUT DEBIAN
moosex::attributehelpers::methodprovider::list
MooseX::AttributeHelpers::MethodProvider::List(3pm) User Contributed Perl Documentation MooseX::AttributeHelpers::MethodProvider::List(3pm)
NAME
MooseX::AttributeHelpers::MethodProvider::List - method generator for MooseX::AttributeHelpers::Collection::List
SYNOPSIS
package Stuff;
use Moose;
use MooseX::AttributeHelpers;
has 'options' => (
metaclass => 'Collection::List',
is => 'rw',
isa => 'ArrayRef[Str]',
default => sub { [] },
auto_deref => 1,
provides => {
elements => 'all_options',
map => 'map_options',
grep => 'filter_options',
find => 'find_option',
first => 'first_option',
last => 'last_option',
get => 'get_option',
join => 'join_options',
count => 'count_options',
empty => 'do_i_have_options',
sort => 'sorted_options',
}
);
no Moose;
1;
DESCRIPTION
This is a role which provides the method generators for MooseX::AttributeHelpers::Collection::List.
METHODS
meta
PROVIDED METHODS
count
Returns the number of elements in the list.
$stuff = Stuff->new;
$stuff->options(["foo", "bar", "baz", "boo"]);
my $count = $stuff->count_options;
print "$count
"; # prints 4
empty
If the list is populated, returns true. Otherwise, returns false.
$stuff->do_i_have_options ? print "Good boy.
" : die "No options!
" ;
find
This method accepts a subroutine reference as its argument. That sub will receive each element of the list in turn. If it returns true
for an element, that element will be returned by the "find" method.
my $found = $stuff->find_option( sub { $_[0] =~ /^b/ } );
print "$found
"; # prints "bar"
grep
This method accepts a subroutine reference as its argument. This method returns every element for which that subroutine reference
returns a true value.
my @found = $stuff->filter_options( sub { $_[0] =~ /^b/ } );
print "@found
"; # prints "bar baz boo"
map This method accepts a subroutine reference as its argument. The subroutine will be executed for each element of the list. It is
expected to return a modified version of that element. The return value of the method is a list of the modified options.
my @mod_options = $stuff->map_options( sub { $_[0] . "-tag" } );
print "@mod_options
"; # prints "foo-tag bar-tag baz-tag boo-tag"
sort
Sorts and returns the elements of the list.
You can provide an optional subroutine reference to sort with (as you can with the core "sort" function). However, instead of using $a
and $b, you will need to use $_[0] and $_[1] instead.
# ascending ASCIIbetical
my @sorted = $stuff->sort_options();
# Descending alphabetical order
my @sorted_options = $stuff->sort_options( sub { lc $_[1] cmp lc $_[0] } );
print "@sorted_options
"; # prints "foo boo baz bar"
elements
Returns all of the elements of the list
my @option = $stuff->all_options;
print "@options
"; # prints "foo bar baz boo"
join
Joins every element of the list using the separator given as argument.
my $joined = $stuff->join_options( ':' );
print "$joined
"; # prints "foo:bar:baz:boo"
get Returns an element of the list by its index.
my $option = $stuff->get_option(1);
print "$option
"; # prints "bar"
first
Returns the first element of the list.
my $first = $stuff->first_option;
print "$first
"; # prints "foo"
last
Returns the last element of the list.
my $last = $stuff->last_option;
print "$last
"; # prints "boo"
BUGS
All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to
cpan-RT.
AUTHOR
Stevan Little <stevan@iinteractive.com>
COPYRIGHT AND LICENSE
Copyright 2007-2009 by Infinity Interactive, Inc.
<http://www.iinteractive.com>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.10.1 2010-01-02 MooseX::AttributeHelpers::MethodProvider::List(3pm)