[PLUG] Perl: deleting text
Sasha Romanosky
sasha_romanosky at yahoo.com
Tue Feb 3 16:33:01 UTC 2004
Or just grep (egrep) -v could work, depending on your actual need.
sasha
> -----Original Message-----
> From: plug-admin at lists.pdxlinux.org
> [mailto:plug-admin at lists.pdxlinux.org] On Behalf Of Jeme A Brelin
> Sent: Tuesday, February 03, 2004 4:07 PM
> To: PLUG
> Subject: Re: [PLUG] Perl: deleting text
>
>
>
> On Tue, 3 Feb 2004, Brian Derr wrote:
> > I'm fairly new to Perl and have been working on a small
> script. Thus
> > far I've got it working perfectly but have one question, how do I
> > remove text from a file? I am keeping a plain text file
> with records
> > that are separated by a '\n\n'. How would I go about deleting a
> > record? I tried getting help on #perl in freenode but no
> one responded
> > so I thought I'd take it to my favorite LUG. :-)
>
> Um, context is important here. You're reading in a file then
> writing it out again? Then you delete it by not writing it.
>
> What kind of records are these? Have you considered using a
> SwissArmy Chainsaw type tool like DBD::CSV (this allows you
> to treat a flat file like a database and use SQL against it)?
>
> Details, details.
>
> oh, and `sed /pattern/d file` works pretty well, too.
>
> J.
> --
> -----------------
> Jeme A Brelin
> jeme at brelin.net
> -----------------
> [cc] counter-copyright
> http://www.openlaw.org
>
> _______________________________________________
> PLUG mailing list
> PLUG at lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plu> g
>
More information about the PLUG
mailing list