>> I could use a simple perl command to change every pipe to "," but that
>> does not take care of the beginning and ending of each line. Any help,
>> advice, pointers appreciated.

Guess I'm not real clear on what you're going to encounter at the beginning
and ending of each line that needs filtering, more "|"?

You could use:

open(FILE, "...
undef($/);  # Allows script to read entire file into scalar
$data = <FILE>;
close FILE;
$data =~ s/\|?\n\|?/\n/sg;  # Removes | immediately before and after \n
$data =~ s/\|/","/sg;       # Changes remaining | to ","


If you don't get the answer you're looking for you might post a note to
[EMAIL PROTECTED]

Glen

Glen Lee Edwards
[EMAIL PROTECTED]

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: "[EMAIL PROTECTED]" for general perl questions
::  [EMAIL PROTECTED]
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::





On Sun, 21 Nov 1999, Mike A. Lewis wrote:

>
>You could also use a simple perl script to prepend and append each line.
>HTH
>Mike
>
>> -----Original Message-----
>> From: gnielson [mailto:[EMAIL PROTECTED]]
>> Sent: Sunday, November 21, 1999 2:15 PM
>> To: [EMAIL PROTECTED]
>> Subject: Script to convert pipe delimited to comma delimited
>> 
>> 
>> Hi everyone:
>> 
>> Would anyone mind sharing a script if they have one on converting pipe
>> delimited ascii data files to comma delimited as in:
>> 
>> from Gary|Gary|Address|City|State
>> to   "Gary","Gary","Address","City","State"
>> 
>> I could use a simple perl command to change every pipe to "," but that
>> does not take care of the beginning and ending of each line. Any help,
>> advice, pointers appreciated.
>> 
>> Thanks
>> 
>> 
>> -- 
>> To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
>> as the Subject.
>> 
>
>
>


-- 
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.

Reply via email to