I have a file which contains blocks of text - each block is a multi-lines text delimited by blank lines eg.
<blank line>
several lines of text
...
pattern found on this line
several more lines of text
...
<blank line>
How do you delete the block of text (including the blank lines) when... (17 Replies)
HI Gurus,
I need to delete a line from a syslog file, if it matches three conditions.
Say for ex., if the device name is device.name.com and if it contains the syslog message PAGP-5-PORTFROMSTP in between the time period 00:00:00 to 04:00:00, then the particular line has to be deleted from... (2 Replies)
I have a file which has the first blank line:
sundev22$cat /t1/bin/startallocs
/t1/bin/startallocsys 123
sundev22$
Is there a command to remove this first blank line? Thanks for help -A (4 Replies)
Hi,
I want to write a sed script which from
batiato:
batiato/giubbe:
pip_b.2.txt
pip_b.3.txt
pip_b.3mmm.txt
bennato:
bennato/peterpan:
123.txt
consoli:
pip_a.12.txt
daniele: (2 Replies)
Need to remove rest of line after the equals sign on search pattern from the searchfile. Can anybody help. Couldn't find any similar example in the forum:
infile:
64_1535: Delm. = 86 var, aaga
64_1535: Fran. = 57 ex. ccc
64_1639: Feb. = 26 (link). def
64_1817: mar. = 3/4. drz ... (7 Replies)
Need help to replace the line beginning with tcp_sendspace with a blank line.
# cat if
en0: flags=1e080863,480<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),CHAIN>
inet 10.27.53.21 netmask 0xffffff00 broadcast 10.207.52.255
inet... (11 Replies)
Hi
Im trying to do the following in sed. I want to delete any blank line at the start of a file until it matches a pattern and then stops. for example:
Input
output:
I have got it to work within a range of two patterns with the following:
sed '/1/,/pattern/{/^]*$/d}'
The... (2 Replies)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
I have file which has got the following content
sam 123 LD 41
sam 234 kp
sam LD 41
kam pu
sam LD 61
Now... (1 Reply)
Dear all
I want to search special string in file and then print next all line in one line until blank lines come. Help me plz for same. My input file and desire op file is as under.
i/p file:
A1/EXT "BSCABD1_21233G1" 757 130823 1157
RADIO X-CEIVER ADMINISTRATION
BTS EXTERNAL FAULT
... (7 Replies)
Discussion started by: jaydeep_sadaria
7 Replies
LEARN ABOUT DEBIAN
test::unit::assertion::regexp
Test::Unit::Assertion::Regexp(3pm) User Contributed Perl Documentation Test::Unit::Assertion::Regexp(3pm)NAME
Test::Unit::Assertion::Regexp - Assertion with regex matching
SYNOPSIS
require Test::Unit::Assertion::Regexp;
my $assert_re =
Test::Unit::Assertion::Regexp->new(qr/a_pattern/);
$assert_re->do_assertion('a_string');
This is rather more detail than the average user will need. Test::Unit::Assertion::Regexp objects are generated automagically by
Test::Unit::Assert::assert when it is passed a regular expression as its first parameter.
sub test_foo {
...
$self->assert(qr/some_pattern/, $result);
}
If the assertion fails then the object throws an exception with details of the pattern and the string it failed to match against.
Note that if you need to do a 'string does not match this pattern' type of assertion then you can do:
$self->assert(qr/(?!some_pattern)/, $some_string)
ie. Make use of the negative lookahead assertion.
IMPLEMENTS
Test::Unit::Assertion::Regexp implements the Test::Unit::Assertion interface, which means it can be plugged into the Test::Unit::TestCase
and friends' "assert" method with no ill effects.
DESCRIPTION
The class is used by the framework to provide sensible 'automatic' reports when a match fails. The old:
$self->assert(scalar($foo =~ /pattern/), "$foo didn't match /.../");
seems rather clumsy compared to this. If the regexp assertion fails, then the user is given a sensible error message, with the pattern and
the string that failed to match it...
AUTHOR
Copyright (c) 2001 Piers Cawley <pdcawley@iterative-software.com>.
All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
o Test::Unit::TestCase
o Test::Unit::Assertion
perl v5.8.8 2006-09-13 Test::Unit::Assertion::Regexp(3pm)