03-13-2008
You may need to clarify your question.
- Reading lines in a loop and match line by line (as you demonstrated): yes
- Reading a string consisting of multiple lines and match that string (across line breaks): yes
For second case, look at the //s modifier.
perlre - perldoc.perl.org
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all,
I've been working on a script which I have hit a road block now. I have written a script using sed to extract the below data and pumped into another file:
Severity............: MAJORWARNING
Summary:
System temperature is out of normal range.
Severity............: MAJORWARNING... (13 Replies)
Discussion started by: phixsius
13 Replies
2. Shell Programming and Scripting
Hello People,
Need some assistance/guidance.
OUTLINE:
Two files (File1 and File2)
File1 has some ids such as
009463_3922_1827
897654_8764_5432
File2 has things along the lines of:
Query= 009463_3922_1827 length=252
(252 letters)
More stufff here
... (5 Replies)
Discussion started by: Deep9000
5 Replies
3. Shell Programming and Scripting
Hi,
I have a text file as follows:
11:38:11.054 run1_rdseq avg_2-5 999988.0000 1024.0000
11:50:52.053 run3_rdrand 999988.0000 1135.0 128.0417
11:53:18.050 run4_wrrand avg_2-5 999988.0000 8180.5833
11:55:42.051 run4_wrrand avg_2-5 999988.0000 213.8333
11:55:06.053... (2 Replies)
Discussion started by: annazpereira
2 Replies
4. Shell Programming and Scripting
Hi,
Input
7488 7389 chr1.fa chr1.fa
3546 9887 chr5.fa chr9.fa
7387 7898 chrX.fa chr3.fa
7488 7389 chr21.fa chr3.fa
7488 7389 chr1.fa chr1.fa
3546 9887 chr9.fa chr5.fa
7898 7387 chrX.fa chr3.fa
Desired Output
7488 7389 chr1.fa chr1.fa 2
3546 9887 chr5.fa chr9.fa 2... (2 Replies)
Discussion started by: jacobs.smith
2 Replies
5. Shell Programming and Scripting
I want to do something like sed -n '/PATTERN/,+10p' and get the ten lines following PATTERN. However, this throws an "expected context address" with the sed that comes with OSX Lion. If that + is a GNUism, can I do this, or do I have to find another tool? (2 Replies)
Discussion started by: jnojr
2 Replies
6. Shell Programming and Scripting
Is there a simple way to use awk to match multiple lines?? Somehow using \n isn't working for me. Ultimately I'm trying to insert "WWW" 3 lines above "eee".
input
aaa
bbb
ccc
ddd
eee
fff
output
aaa
bbb
WWW
ccc
ddd
eee (1 Reply)
Discussion started by: pxalpine
1 Replies
7. Shell Programming and Scripting
Using a regular expression, I would like multiple lines to be matched.
By default, a period (.) matches any character except newline. However, (?s) and /s modifiers are supposed to force . to accept a newline and to match any character including a newline.
However, the following two perl... (4 Replies)
Discussion started by: LessNux
4 Replies
8. Shell Programming and Scripting
Hi,
Need help to grep the following from a file x. I just want to grep exact match not lines and not partial word.
CONFSUCCESS
CONFFAIL
CONFPARTIALSUCCESS
>cat x
xczxczxczc zczczcxx CONFSUCCESS czczczcczc
czxxczxzxczcczc CONFFAIL xczxczcxcczczc
zczczczcz CONFPARTIALSUCCESS czczxcxzc
... (4 Replies)
Discussion started by: rajeshwebspere
4 Replies
9. Shell Programming and Scripting
Not sure how I can accomplish this. I would like to remove all interfaces that have the commands I would like to see: switchport port-security, spanning-tree portfast. One line is no problem.
interface FastEthernet0/8
spanning-tree portfast
interface FastEthernet0/9
spanning-tree... (4 Replies)
Discussion started by: mrlayance
4 Replies
10. Shell Programming and Scripting
GM,
I have an issue at work, which requires a simple solution. But, after multiple attempts, I have not been able to hit on the code needed.
I am assuming that sed, awk or even perl could do what I need.
I have an application that adds extra blank page feeds, for multiple reports, when... (7 Replies)
Discussion started by: jxfish2
7 Replies
LEARN ABOUT DEBIAN
html::auto
HTML::Auto(3pm) User Contributed Perl Documentation HTML::Auto(3pm)
NAME
HTML::Auto - automatic write HTML for common elements
VERSION
Version 0.04
SYNOPSIS
Simple example:
use HTML::Auto qw/matrix h v/;
my @cols = qw/c1 c2 c3 c4 c5/;
my @lines = qw/l1 l2 l3 l4 l5/;
my $data =
[ [1,2,3,4,5],
[6,7,8,9,0],
[1,1,1,1,1],
[2,2,2,2,2],
[3,3,3,3,3] ];
my $m = matrix(@cols,@lines,$data);
print v(
h($m,$m,$m),
h($m,$m),
);
Using attributes:
use HTML::Auto qw/matrix h v/;
my @cols = qw/c1 c2/;
my @lines = qw/l1 l2/;
my $data =
[
[
{v => 1, a => { style => 'background: green'}},
2
],
[
{v => 3, a => {class => 'foo'}},
{v => 4, a => {style => 'color: red'}}
]
];
my $m = matrix(@cols,@lines,$data);
print v(
h($m)
);
With mouse-over span:
use HTML::Auto qw/matrix h v/;
my @cols = qw/c1 c2/;
my @lines = qw/l1 l2/;
my $data =
[[1,2],
[3,
{ v=> 4,
more_info => "This is a pop-up!"
}]
];
my $m = matrix(@cols,@lines,$data);
print v(
h($m)
);
Passing additional CSS:
use HTML::Auto qw/matrix h v/;
my @cols = qw/c1 c2/;
my @lines = qw/l1 l2/;
my $data =
[
[
{v => 1, a => { class => 'warn'}},
2
],
[3,4]
];
my $options = { css => '.warn { background-color: yellow !important; }' };
my $m = matrix(@cols,@lines,$data,$options);
print v(
h($m)
);
SUBROUTINES
/METHODS
matrix
h
A function to allow horizontal composition.
v
A function to allow vertical composition.
AUTHOR
Nuno Carvalho, "<smash at cpan.org>" Andre Santos, "<andrefs at cpan.org>"
BUGS
Please report any bugs or feature requests to "bug-html-auto at rt.cpan.org", or through the web interface at
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=HTML-Auto <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=HTML-Auto>. I will be notified,
and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc HTML::Auto
You can also look for information at:
o RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=HTML-Auto <http://rt.cpan.org/NoAuth/Bugs.html?Dist=HTML-Auto>
o AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/HTML-Auto <http://annocpan.org/dist/HTML-Auto>
o CPAN Ratings
http://cpanratings.perl.org/d/HTML-Auto <http://cpanratings.perl.org/d/HTML-Auto>
o Search CPAN
http://search.cpan.org/dist/HTML-Auto/ <http://search.cpan.org/dist/HTML-Auto/>
ACKNOWLEDGEMENTS
LICENSE AND COPYRIGHT
Copyright 2012 Project Natura.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as
published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
perl v5.14.2 2012-06-05 HTML::Auto(3pm)