[Pdx-pm] Simplistic, yet complicated question....
Andrew S. Clapp
clapp at netscum.com
Mon Dec 9 13:02:52 CST 2002
You need to "perldoc perlrequick" or "perldoc perlre".
\s+ will match what you want.
-ASC
On 09 Dec 2002 10:47:40 -0800
aj <aj at linuxaid.org> wrote:
> Sorry about the confusion...
>
> Again here is the data:
>
> 123454 text 67890 Get Rid of text
> 234555 more text to keep
>
> The text I am wanting to remove is "67890 Get rid of text". The only
> pattern to this data is the multiple spaces between "12344 text" and
> "67890 text". The space pattern could be 2 or it could be 20. I would
> think if I could do a split on this the top line with a variable amount
> of spaces and then I would just remove the second portion of the line.
> Does this make better sense?
>
> Thanks Again,
> A.J. Weinzettel
>
>
> On Mon, 2002-12-09 at 10:09, Jeff Zucker wrote:
> > aj wrote:
> >
> > > I am parsing a text file and I have the following layout of text
> > >
> > >
> > > 123454 text 67890 Get Rid of text
> > > 234555 more text to keep
> > >
> > > My first idea is to substitue two spaces with nothing
> > > ( $line =~ s/ //g) and then try to do some sort of split on the
> > > resulting. I am sure there is a better way of doing this, but not
> > > having too much luck finding an answer. Any suggestions would be
> > > greatly appreciated.
> >
> >
> > You'll have to do a better job of describing what the constant factors
> > are and what you want to keep/eliminate. Do you want to get rid of text
> > that is after the third set of whitespaces in a given line? Or text
> > after the number 67890? Or text after the second set of numerical data
> > in a line? Or text that is after position X in each line? Any of those
> > could describe the data you've shown.
> >
> > If you can describe what you want to do in English (or some other human
> > language) it's usually fairly easy to do in Perl.
> --
> aj <aj at linuxaid.org>
>
> _______________________________________________
> Pdx-pm-list mailing list
> Pdx-pm-list at mail.pm.org
> http://mail.pm.org/mailman/listinfo/pdx-pm-list
Andrew S. Clapp - <clapp at netscum dot com> - Geekin' Geekin' Geekin'
rat: "Hmmm, wonder what bob just changed in dont_touch.c..."
rat: % lastdiff dont_touch.c
<rat reviews diff>
rat: "Yup, that completely sucks! Where's my flamethrower..."
bob: "Hi rat, what's that ... Yeeaarrrrrrghhh!"
More information about the Pdx-pm-list
mailing list