Re: OT: a problem about text manipulation



On Tue, 31 Oct 2006, Joe Klemmer wrote:

On Tue, 2006-10-31 at 03:05 -0800, Benjamin Franz wrote:

Assuming that what you *MEANT* for your output example was
[...]]
the following Perl script should do it.

If I ever happen to get motivated I might try and do an awk script for
this. It's likely to be much simpler/smaller than the perl version
(though not necessarily any better, OC).


#!/usr/bin/perl -na

foreach my $i (@F) { ($i =~ m/^[0-9]+$/) ? $a = $i : print "$a $i\n" }

:)))

--
Benjamin Franz

Perl - A post-modern programming language or a
scripting tool gone horribly, horribly wrong?
-- Rob Malda

--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list



Relevant Pages

  • Re: sed: s/// not an address?
    ... But why can I use, for instance, the p command but not h? ... stubborn sed phase. ... perl, ... the awk script would be: ...
    (comp.unix.shell)
  • Re: regex within a DCL procedure
    ... did I missed another lighter tool? ... Perl is an obvious choice. ... Since we had twenty-five systems in the data center and up to a dozen licenses per system this was quite a task. ... I spent part of the weekend developing and debugging my awk script, came in Monday morning, ran my script on each system and handed the results to my boss half an hour or so later. ...
    (comp.os.vms)
  • Re: evaluation of logical expression
    ... Ed Morton wrote: ... not even TAWK has eval. ... Perl does... ... build procedure to make it assemble the AWK script before running it. ...
    (comp.lang.awk)
  • Re: question about the linux command "file"
    ... > interested in doing this in perl but I dont know perl atm... ... > JPEG image data:jpg ... > MPEG video stream data:mpg ... I would use an awk script where BEGIN reads in the .matrix file and ...
    (comp.unix.shell)
  • Re: OT: a problem about text manipulation
    ... If I ever happen to get motivated I might try and do an awk script for ... It's likely to be much simpler/smaller than the perl version ... sumo game ranks and other interesting junk ...
    (Fedora)