07-12-2009
Thanks, I really appreciate it.
There is one other thing. You have undef $\. Which is good if the file is small. But the files are going to grow and this is why I am trying to go line by line using the while loops. The only trouble is catching the next "n" lines before the start of other Query=
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
Could any one tell me how to read and match multiple lines in perl? Did this code below still work in this situation?
while (<FILE>) {
if (/ /) {
}
}
Thanks a lot! (5 Replies)
Discussion started by: zx1106
5 Replies
3. Shell Programming and Scripting
Hi
I have a file (say 'file1')and I want to search for a first occurence of pattern (say 'ERROR') and print ten lines in the file below pattern. I have to code it in PERL and I am using Solaris 5.9.
I appreciate any help with code
Thanks
Ammu (6 Replies)
Discussion started by: ammu
6 Replies
4. Shell Programming and Scripting
I have sql file containing lot of queries on different database table. I have to filter specific table queries.
Let say i need all queries of test1,test2,test3 along with four lines above it and sql queries can be multi lines or in single line.
Input file contains.
set INSERT_ID=1;
set... (1 Reply)
Discussion started by: mirfan
1 Replies
5. Shell Programming and Scripting
Hi
I know sed and awk has options to give range of line numbers, but
I need to replace pattern in specific lines
Something like
sed -e '1s,14s,26s/pattern/new pattern/' file name
Can somebody help me in this....
I am fine with see/awk/perl
Thank you in advance (9 Replies)
Discussion started by: dani777
9 Replies
6. Shell Programming and Scripting
Hi, i have a big file having many opcodes.
if (opcode="01110000000100000000" ) then --fadd
result.opcode := "01110000000100000000";
result.s0 := '1';
result.s1 := '1';
result.s2 := '0';
result.inst := '0';
result.scalar := '1';... (7 Replies)
Discussion started by: twistedpair
7 Replies
7. Shell Programming and Scripting
'Hi
I'm using the following code to extract the lines(and redirect them to a txt file) after the pattern match. But the output is inclusive of the line with pattern match.
Which option is to be used to exclude the line containing the pattern?
sed -n '/Conn.*User/,$p' > consumers.txt (11 Replies)
Discussion started by: essem
11 Replies
8. Shell Programming and Scripting
Hello Experts , require help . See below output:
File inputs
------------------------------------------
Server Host = mike
id rl images allocated last updated density
vimages expiration last read <------- STATUS ------->... (4 Replies)
Discussion started by: tigerhills
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
text::micromason::catcherrors
MicroMason::CatchErrors(3pm) User Contributed Perl Documentation MicroMason::CatchErrors(3pm)
NAME
Text::MicroMason::CatchErrors - Add Exception Catching for Templates
SYNOPSIS
Instead of using this class directly, pass its name to be mixed in:
use Text::MicroMason;
my $mason = Text::MicroMason->new( -CatchErrors );
Use the standard compile and execute methods to parse and evalute templates:
print scalar $mason->compile( text=>$template )->( @%args );
print scalar $mason->execute( text=>$template, @args );
Result is undef on exception, plus an error message if in list context:
($coderef, $error) = $mason->compile( text=>$template );
($result, $error) = $mason->execute( text=>$template, 'name'=>'Dave' );
DESCRIPTION
This package adds exception catching to MicroMason, allowing you to check an error variable rather than wrapping every call in an eval.
Both compilation and run-time errors in your template are handled as fatal exceptions. The base MicroMason class will croak() if you
attempt to compile or execute a template which contains a incorrect fragment of Perl syntax. Similarly, if the Perl code in your template
causes die() or croak() to be called, this will interupt your program unless caught by an eval block.
This class provides that error catching behavior for the compile and execute methods.
In a scalar context they return the result of the call, or undef if it failed; in a list context they return the results of the call (undef
if it failed) followed by the error message (undef if it succeeded).
Public Methods
compile()
$code_ref = $mason->compile( text => $template, %options );
($coderef, $error) = $mason->compile( text=>$template, %options );
Uses an eval block to provide an exception catching wrapper for the compile method.
execute()
$result = $mason->execute( text => $template, @arguments );
($result, $error) = $mason->execute( text=>$template, 'name'=>'Dave' );
Uses an eval block to provide an exception catching wrapper for the execute method.
SEE ALSO
For an overview of this templating framework, see Text::MicroMason.
This is a mixin class intended for use with Text::MicroMason::Base.
For distribution, installation, support, copyright and license information, see Text::MicroMason::Docs::ReadMe.
perl v5.10.1 2007-01-29 MicroMason::CatchErrors(3pm)