I find that for doing multiple edits on a single line on a single pass its best to use awk.

-Jared

On 3/1/06, douglas.r.aker@verizon.com <douglas.r.aker@verizon.com> wrote:

Thanks Jared and Frank for your quick responses.

The solution, it turns out, had nothing to do with RE's, but rather with input lines and files.

I'm dealing with multi-line, comma-separated-value records, using Perl programs to convert them to single line records, change bare carriage-return characters to newline characters and eventually remove extraneous trailing commas, e.g. ...,"Moe, Larry, Curly, ",... (the comma and space after "Curly" is extraneous).  I guess you can only do so much in one pass through an input file.

The solution was to write two Perl programs, and use a two-stage process as in:

cat multi-line-input-records | makethemsinglelines.pl | removetrailingcommas.pl > greatlookingfile.out

Thanks again,
Doug




"Frank Sweetser" <fs@WPI.EDU>
Sent by: wlug-bounces@mail.wlug.org

03/01/2006 09:40 AM
Please respond to
"Worcester Linux Users Group" <wlug@mail.wlug.org>

To
"Worcester Linux Users Group" <wlug@mail.wlug.org>
cc

Subject
Re: [Wlug] Perl puzzle







On Wed, Mar 01, 2006 at 09:30:26AM -0500, douglas.r.aker@verizon.com wrote:
> The obvious   s/, "/"/g  doesn't work, nor does escaping the
> double-quotes, as in   s/, \"/\"/g

Try

$target =~ s/,\s\"/\"/g;

--
Frank Sweetser fs at wpi.edu  |  For every problem, there is a solution that
WPI Network Engineer          |  is simple, elegant, and wrong. - HL Mencken
   GPG fingerprint = 6174 1257 129E 0D21 D8D4  E8A3 8E39 29E3 E2E8 8CEC
_______________________________________________
Wlug mailing list
Wlug@mail.wlug.org
http://mail.wlug.org/mailman/listinfo/wlug



_______________________________________________
Wlug mailing list
Wlug@mail.wlug.org
http://mail.wlug.org/mailman/listinfo/wlug