Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi I have a question Is

Status
Not open for further replies.

franklinmount

Technical User
May 5, 2003
5
US
Hi

I have a question



Is there an easy way to parse this in perl?



DESCRIPTION PROBLEM:



I have a DBF file that I opened in MS ACCESS and than imported it into MS Access. This file is either DBASE or FOXPRO which I have neither of the programs.



I than exported it into a text file within MS Access as a comma delimited file.



Here is my problem; Three of the columns which have data have no delimiters on some of the data. This is the way it looked after I opened it up in notepad.

I am fairly new to perl so I need some help in trying to parse this file. I need to break out the data into lines in the row. I have open the text file in a binary editor and the two hex characters it uses is 0D and 0A to separate each line. SEE BELOW in (courier font)

Is there an easy way to do this in PERL, to write a small program to parse this data where it can pick up on the two hex characters of each line?
For example (NUMBER OF EXITS AND THEIR LOCATIONS:) this line
shows the hex character in the end of the line as OD & OA in the binary editor. How can I write a perl code to look for this two characters so that it can print out to next line.



For your information the text that is highlight in RED and that is in a font (courier) should all go together and is not being listed across as is should because there was no delimiters. This is the main problem.







ZIP SYSTEM NOTES CENTRAL



"15531",,,"MASTER CODE: 4110

"15963",,,"MASTER CODE: 1975



DIRECTIONS: 219 TO RT.56 TAKE 12TH ST. EXIT-TURN RIGHT BY RIVERSIDE MARKET

TO GRAHAM AVE. TURN RIGHT, TO NEXT LEFT GO ONE BLOCK TURN LEFT ONTO

SOMERSET ST. GO OVER THE RAILROAD TRACKS ON TO 17TH ST. RAILROAD ST. BEARS

TO THE LEFT 10TH OR SO HOUSE.

"

*********************** FIRE EVACUATION PLAN *****************************ì

MEMBERS NAME: xxxxx, xxxx, xxx xxxxxxxxx

EVACUATION LEADER #1: xxxxx xxxxxxxxx

NUMBER OF EXITS AND THEIR LOCATIONS:

1. FRONT DOOR

2. REAR DOOR

3. BEDROOM WINDOWS

NAMES OF RESIDENTS AND THEIR ASSIGNED EXITS:

1. EMY - EXIT THROUGH REAR DOOR

2. xxxxx AND xxxx - EXIT THROUGH BACK DOOR OR BEDROOM WINDOWS

AGREED OUTSIDE MEETING PLACE: ALLEY REAR OF HOUSE

SPECIAL CONSIDERATIONS: NONE

******************** EMERGENCY MEDICAL INFORMATION *******************

MEMBERS NAME: xxxxxx xxxxxxxxx

MALE: X HEIGHT:x'xx"" WEIGHT: xxx DOB: x-xx-xx

BLOOD TYPE: x xxx

BAMILY PHYSICIAN NAME: xx. xxxxxxx

ADDRESS: xxxx xxxxxxxxxx. xxxx

Xxxxxxxxx, PA

TELEPHONE: xxx-xxx-xxxx

HOSPITAL OF CHOICE: xxx HOSPITAL

ADDRESS: xxx xxxx xxxx

xxxxxxxxx, PA

TELEPHONE: xxx-xxx-xxxx

CURRENT CONDITIONS:

1. NONE

MEDICATIONS:

1. NONE



Any help would be appreciated.



thanks,



Mario








 
0D 0A is just the windows newline "character", commonly referred to as CR/LF (carriage return/line feed). The default input record separator is the newline, so if you just read the file in a scalar at a time in a loop, it'll stop at that sequence automatically for you each iteration.

If it can be parsed, perl can parse it. Hope this points you in the right direction.

----------------------------------------------------------------------------------
...but I'm just a C man trying to see the light
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top