Re: OT: a problem about text manipulation



Benjamin Franz wrote:
...
Darn it, now you have me playing Perl Golf ...

Fore!

#!/usr/bin/perl -na

$k = shift @F; print "$k $_\n" for @F

Mine doesn't care about the contents of the fields, only the positions.

Neither yours nor mine will handle the input below, which the OP asked about in response to another suggestion.

Here's a version that will work for lines having only a number:

#!/usr/bin/perl -na

$k = shift @F; print "$k $_\n" for @F ? @F : ''

--input--
1 E E E
2 C D
6
3 B E D
4 C E D
5 D E
--output--
1 E
1 E
1 E
2 C
2 D
6
3 B
3 E
3 D
4 C
4 E
4 D
5 D
5 E

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



Relevant Pages

  • Re: OT: a problem about text manipulation
    ... On Tue, 31 Oct 2006, Benjamin Franz wrote: ... If I ever happen to get motivated I might try and do an awk script for ... Darn it, now you have me playing Perl Golf: ...
    (Fedora)
  • Re: A new COUNTDOWN teaser image has been released - VILLAINS!
    ... a fallen statue of Darkseid. ... but she seems pretty darn happy in this image. ... I don't care what he said, that was still a pretty shitty way to treat ... Bad enough he didn't use his newfound powers to ...
    (rec.arts.comics.dc.universe)
  • Re: [OT] Re: the vanished need for posting "context"
    ... Oh no ive spellt somefing wrong, and he's picked me up on, darn i feel sily. ... like i care what you think. ... the "gang-boy" lingo was a reference to you and the terms you spatter throughout your writing. ...
    (rec.games.roguelike.nethack)
  • Re: Moria I64 and problems with macro
    ... I'll upload them to my VMS stuff page. ... Thanks VAXman, that took care of it - darn it, I was very close;-). ...
    (comp.os.vms)
  • Re: Hope for the future
    ... darn, there was federal money to take care of immigrants for one or ...
    (rec.aviation.piloting)