I have searched forum trying to find a solution to my problem, but could not find anything or I did not understand the examples....
I should say, I am very inexperienced with text processing.
I have a text file with approx 60k lines in it.
I need to merge lines based on the number on the end of the "master line".
Example1:
So, here I need to delete one pipe character and number 1 after the word 'Word' and merge first line with second line. Delete number 1 and this "(" and this ")" characters. Result should look like this:
Example 2:
Here I need to delete one pipe character and number 4 after the word 'Eye' and merge first line with four following lines. Delete number 1 and 2 and 3 and 4 and this "(" and this ")" characters. Result should look like this:
So, if the txt file looks like this before processing:
I need it look like this after processing:
Could somebody help me with this please?
Hi
I have the fixed width flat file having the following data
12345aaaaaaaaaabbbbbbbbbb
12365sssssssssscccccccccc
12365sssss
12367ddddddddddvvvvvvvvvv
12367 vvvvv
Here the first column is length 5 second is length 10 third is length 10
if the second or third column exceeds... (3 Replies)
My input:
File_1:
2000_t
g1110.b1
abb.1
2001_t
g1111.b1
abb.2
abb.2
g1112.b1
abb.3
2002_t
.
.
File_2:
2000_t Ali england 135
abb.1 Zoe british 150
2001_t Ali england 305
g1111.b1 Lucy russia 126 (6 Replies)
I have one comma separated file (a.txt) with two or more records all matching except for the last column.
I would like to merge all matching lines into one and consolidate the last column, separated by ":". Does anyone know of a way to do this easily?
I've searched the forum but most talked... (6 Replies)
Hello! i have a text file.. which contains the data as follows
i want to merge the declarations lines pertaining to one datatype in to a single line as follows
i've searched the forum for help.. but couldn't find much help.. how can i do this?? (1 Reply)
I have a text file with a list of items/patterns:
ConsensusfromCGX_alldays_trimmedcollapsedfilteredreadscontiglist(229095contigs)contig12238
ConsensusfromCGX_alldays_trimmedcollapsedfilteredreadscontiglist(229095contigs)contig34624... (1 Reply)
Hello Everyone,
I have two files I created in a format similar to the ones found below (character position is important):
File 1:
21 Cat Y N S Y Y N N
FOUR LEGS
TAIL
WHISKERS
30 Dog N N 1 Y Y N N
FOUR LEGS
TAIL
33 Fish Y N 1 Y Y N N
FINS
43 CAR Y N S Y Y N N
WHEELS
DOORS... (7 Replies)
Hi,
I am trying to extract lines from a text file given a text file containing line numbers to be extracted from the first file. How do I go about doing this? Thanks! (1 Reply)
Hi,
I have a requirement to merge multiple lines based on search pattern. The search criteria is : it will search for CONSTRAINT and when it found CONSTRAINT, it will merge all lines to 1 line till it founds blank line.
For Example:
CREATE TABLE "AMS_DISTRIBUTOR_XREF"
(
"SOURCE"... (5 Replies)
Hi
I need to order these lines from a txt file my file looks like this
IMSI ........................ 1234567890
APN ......................... INTERNET.COM
APN ......................... MMS.COM
APN ......................... WAP.COM
APN ......................... BA.COM
IMSI... (4 Replies)
Discussion started by: alone77
4 Replies
LEARN ABOUT DEBIAN
html::microformats::format::xoxo
HTML::Microformats::Format::XOXO(3pm) User Contributed Perl Documentation HTML::Microformats::Format::XOXO(3pm)NAME
HTML::Microformats::Format::XOXO - the XOXO microformat
SYNOPSIS
use HTML::Microformats::DocumentContext;
use HTML::Microformats::Format::XOXO;
my $context = HTML::Microformats::DocumentContext->new($dom, $uri);
my @objects = HTML::Microformats::Format::XOXO->extract_all(
$dom->documentElement, $context);
my $list = $objects[0];
# Let's assume this structure:
#
# <ol class="xoxo people">
# <li>
# <a href="http://tobyinkster.co.uk/">Toby Inkster</a>
# <dl>
# <dt>Eye colour</dt>
# <dd>Blue</dt>
# <dt>Hair colour</dt>
# <dd>Blonde</dt>
# <dd>Brown</dt>
# </dl>
# </li>
# </ol>
print $list->data->as_array->[0]->get_link_title;
# Toby Inkster
print $list->data->as_array->[0]->get_properties
->get_value('Eye colour')->[0];
# Blue
print join '-', $list->data->as_array->[0]
->get_value('Hair colour');
# Blonde-Brown
DESCRIPTION
HTML::Microformats::Format::XOXO inherits from HTML::Microformats::Format. See the base class definition for a description of property
getter/setter methods, constructors, etc.
Unlike most of the modules in the HTML::Microformats suite, the "data" method returns an HTML::Microformats::Format::XOXO::UL,
HTML::Microformats::Format::XOXO::OL or HTML::Microformats::Format::XOXO::DL object, rather than a plain hashref.
HTML::Microformats::Format::XOXO::DL
Represents an HTML DL element.
"$dl->get_values($key)"
Treating a DL as a key-value structure, returns a list of values for a given key. Each value is an
HTML::Microformats::Format::XOXO::DD object.
"$dl->as_hash"
Returns a hash of keys pointing to arrayrefs of values, where each value is an HTML::Microformats::Format::XOXO::DD object.
"$dl->as_array"
Logically what you think get_values("*") might do.
HTML::Microformats::Format::XOXO::UL
Represents an HTML UL element.
"$ul->as_array"
Returns an array of values, where each is a HTML::Microformats::Format::XOXO::LI object.
HTML::Microformats::Format::XOXO::OL
Represents an HTML OL element.
"$ol->as_array"
Returns an array of values, where each is a HTML::Microformats::Format::XOXO::LI object.
HTML::Microformats::Format::XOXO::LI
Represents an HTML LI element.
"$li->get_link_href"
Returns the URL linked to by the first link found within the item.
"$li->get_link_rel"
Returns the value of the rel attribute of the first link found within the item. This is an unparsed string.
"$li->get_link_type"
Returns the value of the type attribute of the first link found within the item. This is an unparsed string.
"$li->get_link_title"
Returns the value of the rel attribute of the first link found within the item if present; the link text otherwise.
"$li->get_text"
Returns the value of the text in the LI element except for the first DL element within the LI, and the first UL or OL element.
"$li->get_html"
Returns the HTML code in the LI element except for the first DL element within the LI, and the first UL or OL element.
"$li->get_properties"
Returns an HTML::Microformats::Format::XOXO::DL object representing the first DL element within the LI.
"$li->get_children"
Returns an HTML::Microformats::Format::XOXO::OL or HTML::Microformats::Format::XOXO::UL object representing the first OL or UL element
within the LI.
"$li->get_value($key)"
A shortcut for "$li->get_properties->get_values($key)".
HTML::Microformats::Format::XOXO::DD
This has an identical interface to HTML::Microformats::Format::XOXO::LI.
MICROFORMAT
HTML::Microformats::Format::XOXO supports XOXO as described at <http://microformats.org/wiki/xoxo>.
RDF OUTPUT
XOXO does not map especially naturally to RDF, so this module returns the data as a JSON literal using the property
<http://open.vocab.org/terms/json>.
BUGS
Please report any bugs to <http://rt.cpan.org/>.
SEE ALSO
HTML::Microformats::Format, HTML::Microformats.
AUTHOR
Toby Inkster <tobyink@cpan.org>.
COPYRIGHT
Copyright 2008-2011 Toby Inkster
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
DISCLAIMER OF WARRANTIES
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
perl v5.14.2 2011-12-06 HTML::Microformats::Format::XOXO(3pm)