PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: "Rob Fenstermacher" <fence at bwn dot net>
Subject: Re: extracting data at a specific displacement
Date: Jun 12 2000 5:25AM

Shoshana-
    there are many ways to extract data in this manner, one way to consider
is reading each line into a string and then use the substr function to
extract the parts that you want into separate strings.

for example, if you want to get bytes 43-63 from the string containing a
line from your file ($input_line):
   $col1 = substr($input_line,42,21)

would put $input_string columns 43-63 into string $col1--get byte 42
(remember perl is zero relative) for 21 bytes.

HTH

Rob Fenstermacher
---
Interested in the Colorado Lottery?
check out http://colotto.com

----- Original Message -----
From: "Klein, Shoshana R" 
To: "SybPerl Discussion List" 
Sent: Sunday, June 11, 2000 12:59 PM
Subject: extracting data at a specific displacement


> I'm a mainframe programmer with a minimal amount of experience with perl.
>
>
> Is there a way to extract data from a flat file based on a specific
> displacement and length?
> Until now I've been using regular expressions to match the data  I need,
but
> I find this
> very time consuming  when I know I want bytes 43-63 no matter what it
> contains.
>