03-07-2005
Sorry Guys, maybe I didn't put it correctly. The amount of "useful data" isn't known i.e. it may be 2 lines long or 10/20/100 i.e. no same occurences. Same goes for the "sample data" too. Its only that "start" and "end" is that can tell me where to start from and where to end.
Later I figured a way to print the block and so currently I am using following in awk file:
/^start/./^end/
Thereafter I grep out (grep -v) the start and end text.
Cheers
Arminder
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I have file (FILE.tmp) having contents,
FILE.tmp
========
filename=menudata
records=0000000000037
ldbname=pinsys
timestamp=2005/05/14-18:32:33
I want to parse it bring a new file which will look like,
filename records ldbname timestamp... (2 Replies)
Discussion started by: Omkumar
2 Replies
2. UNIX for Dummies Questions & Answers
Hi
I need to calculate the number of occurrences of a item in a number of files using Perl.
The item appears continually throughout the files but in each case I only want to calculate it in certain blocks of the file.
Example - Calculalte the number of occurrences of a 'pass' in a block of... (0 Replies)
Discussion started by: oop
0 Replies
3. Shell Programming and Scripting
Hi,
I want to extract block of data from flat file.
the data will be like this
start of log
One
two
three
end of log
i want all data between start of log to end of log i.e One
two
three to be copied to another file.
This particular block may appear multiple times in same file. I... (4 Replies)
Discussion started by: shirish_cd
4 Replies
4. Shell Programming and Scripting
Here is a data file, which I believe is in YAML. I am trying to retrieve just the 'addon_domains" section, which doesnt seem to be as easy as I had originally thought. Any help on this would be greatly appreciated!! I have been trying to do this in awk and mostly bash scripting instead of perl... (3 Replies)
Discussion started by: Rhije
3 Replies
5. UNIX for Dummies Questions & Answers
Hello,
Please can someone assist.
I have the following xml file:
<?xml version="1.0" encoding="utf-8" ?>
- <PUTTRIGGER xmlns:xsd="http://www.test.org/2001/XMLSchema" xmlns:xsi="http://www.test.org/2001/XMLSchema-instance" APPLICATIONNUMBER="0501160" ACCOUNTNAME="Mrs S Test"... (15 Replies)
Discussion started by: Dolph
15 Replies
6. Shell Programming and Scripting
Hi,
I have one file, say file 1, that has data like below where 19900107 is the date,
19900107 12 144 129 0.7380047
19900108 12 168 129 0.3149017
19900109 12 192 129 3.2766666E-02
... (3 Replies)
Discussion started by: Wynner
3 Replies
7. Shell Programming and Scripting
Hello,
This is my first post in here, so excuse me if I sound too noob here!
I need to extract the path "/apps/mp/installedApps/V61/HRO/hrms_01698_A_qa.ear" from the below xml extract. The path will always appear with the key "binariesURL"
<deployedObject... (6 Replies)
Discussion started by: abhishek2386
6 Replies
8. UNIX for Dummies Questions & Answers
I am trying to compare the data in lines 3 & 5 to see if they match up to the '-S570' (see first code set, all proprietary information has been removed from code set)
spawn telnet
Trying ...
Connected to CA-LOS1234-ASE-S570.cl .
Escape character is '^]'.
CA-LOS1234-ASE-S570
Username: ... (1 Reply)
Discussion started by: slipshft
1 Replies
9. Shell Programming and Scripting
consider the input file which i am dealing with looks like this..
#cat 11.sql
create table abc (
.
.
.
) engine=Innodb ;
.
.
etc
.
.
.
create table UsM (
blah
blah
blah
) engine=Innodb ; (5 Replies)
Discussion started by: vivek d r
5 Replies
10. Shell Programming and Scripting
Hey Guys,
I'm a novice at shell scripts and i need some help parsing file data.
Basically, I want to write a script that retrieves URLs.
Here is what I have so far.
#!/bin/bash
echo "Please enter start date (format: yyyy-mm-dd):\c"
read STARTDATE
echo "Please enter end date... (7 Replies)
Discussion started by: silverdust
7 Replies
LEARN ABOUT DEBIAN
data::pager
Data::Pager(3pm) User Contributed Perl Documentation Data::Pager(3pm)
NAME
Data::Pager - flexible data pager
SYNOPSIS
use Data::Pager;
my $pager = Data::Pager->new({
current => 100,
perpage => 10,
offset => 5,
limit => 2000,
});
#~ accessors:
$pager->current; # 100
$pager->next; # 101
$pager->prev; # 99
$pager->limit; # 2000
$pager->start; # 1 # not typical start of a programmer
$pager->final; #
# 400 (which denotes 2000 / 5 pager links)
$pager->end; # /
$pager->from; # 495 (may serve in SQL LIMIT clause)
$pager->to; # 500 (may serve in SQL LIMIT clause)
$pager->list; # 95 96 97 98 99 100 101 102 103 104 105
DESCRIPTION
This class implements the familiar pager where the current position is centered.
CONSTRUCTOR
new
my $pager = Data::Pager->new({
current => 1, # this is the current pager position
perpage => 10, # the pager consists of this number of links (defaults to 10)
offset => 5, # this is the number of results (fetched from the DB for example) per result
limit => 100, # how far is the pager allowed
});
# sample output from html table:
id ... ..... ...
1. ... ..... ...
2. ... ..... ...
3. ... ..... ...
4. ... ..... ...
5. ... ..... ...
1 2 3 4 5 6 7 8 9 10
Returns object or undef if current position is beyond the limit.
METHODS
current
$pager->current();
Returns the current pager position.
set_current($digit)
$pager->set_current(850);
$pager->set_current(850)->next();
Sets the current pager position. Returns the pager object on succes, undef on false.
next
Returns the next pager position or undef if this is the last one.
prev
Returns the previous pager position or undef if this is the first one.
start
Returns 1 - the start pager position.
end
Returns the end pager position.
first
Returns the first pager position for this result set.
last
Returns the last pager position for this result set.
from
'1' => {
'to' => 5,
'next' => 2,
'prev' => undef,
'from' => 0
},
'2' => {
'to' => 10,
'next' => 3,
'prev' => 1,
'from' => 5
},
...
Returns the start result this pager position refers to.
to
Returns the end result this pager position refers to.
list
@_ = $pager->list;
$_ = $pager->list;
Returns the pager links for this result set. In list context returns the resulting list. In scalar context returns reference to the
resulting list.
# note the alignment
$pager->set_current(10);
print $pager->list; # 6 7 8 9 [10] 11 12 13 14 15
$pager->set_current(33);
print $pager->list; # 28 29 30 31 32 [33] 34 35 36 37 38
SEE ALSO
Data::Page
BUGS
What BUGS?
AUTHOR
Vidul Nikolaev Petrov, vidul@cpan.org
COPYRIGHT
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
perl v5.10.0 2006-04-04 Data::Pager(3pm)