I followed the egrep example given in the thread "parse text or complex grep ?". It is exactly what I need...except... how do I insert a blank line after the second line? My exact command is:
egrep 'patt1|patt2' filename
the result is:
patt1
patt2
patt1
patt2
and so on. I would... (2 Replies)
Hello friends,
I have a C source code containing sql statements. I use the following sed command to print all the sql blocks in the source code....
sed -n "/exec sql/,/;/p" Sample.cpp
The above sed command will print the sql blocks based on the pattern "exec sql" & ";"... (2 Replies)
Hi,
I need to match lines after a pattern, upto the first blank line.
Searched in web and some forums but coulnt find the answer.
where <restart_step> =
10 -- Execute query
20 -- Write the contents to the Oracle table
30 -- Writing Contents to OUTPUT... (7 Replies)
Hello...
I have a file which contain certain number of records.
I want to generate another file from this file which will contain 1st line as a blank line & after every 5 lines one blank line will be inserted. How to achieve this through shell scripting?
Thanks... (5 Replies)
I use the following as part of a script to correct for a faulty hostname file.
# get the domain name
read -r thehostname < /etc/hostname
dom="$(echo $thehostname | cut -d'.' -f2)"
numchar=${#dom}
if
then
echo "It appears as though the hostname is not correctly set."
echo "Hostname has... (5 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)
Hi Guys,
I am stuck in between and seeking help here.
Requirement: A script that will run every morning which will connect to Mysql database and run the query to inform us about the holidays (it will also check if there were any holidays during last 2 business days). So the three queries are... (11 Replies)
Input: START
OS:: UNIX
Release: xxx
Version: xxx
END
START
OS:: LINUX
Release: xxx
Version: xxx
END
START
OS:: Windows
Release: xxx
Version: xxx
ENDHere i am trying to get all the information between START and END, only if i could match OS Type.
I can get all the data between the... (3 Replies)
Discussion started by: Dharmaraja
3 Replies
LEARN ABOUT DEBIAN
number::range
Number::Range(3pm) User Contributed Perl Documentation Number::Range(3pm)NAME
Number::Range - Perl extension defining ranges of numbers and testing if a number is found in the range. You can also add and delete from
this range.
SYNOPSIS
use Number::Range;
my $range = Number::Range->new("-10..10,12,100..120");
if ($range->inrange("13")) {
print "In range
";
} else {
print "Not in range
";
}
$range->addrange("200..300");
$range->delrange("250..255");
my $format = $range->range;
# $format will be '-10..10,12,100..120,200..249,256..300'
DESCRIPTION
Number::Range will take a description of a range, and then allow you to test on if a number falls within the range. You can also add and
delete from the range.
RANGE FORMAT
The format used for range is pretty straight forward. To separate sections of ranges it uses a "," or whitespace. To create the range, it
uses ".." to do this, much like Perl's own binary ".." range operator in list context.
METHODS
new
$range = Number::Range->new("10..20","25..30");
Creates the range object. It will accept any number of ranges as its input.
addrange
$range->addrange("22");
This will also take any number of ranges as input and add them to the existing range.
delrange
$range->delrange("10");
This will also take any number of ranges as input and delete them from the existing range.
inrange
$range->inrange("26"); my @results = $range->inrange("27","200");
This will take one or more numbers and check if each of them exists in the range. If passed a list, and in array context, it will
return a list of 0's or 1's, depending if that one was true or false in the list position. If in scalar context, it will return a
single 1 if all are true, or a single 0 if one of them failed.
range
$format = $range->range; @numbers = $range->range;
Depending on context this will return either an array of all the numbers found in the range, for list context. For scalar context it
will return a range string.
size
$size = $range->size;
This will return the total number of entries in the range.
EXPORT
None by default.
SEE ALSO
Number::Tolerant, Tie::RangeHash, and Array::IntSpan for similar modules.
AUTHOR
Larry Shatzer, Jr., <larrysh@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2004-12 by Larry Shatzer, Jr.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2012-06-20 Number::Range(3pm)