Re: OT: a problem about text manipulation
- From: Joe Smith <jes@xxxxxxxxxxx>
- Date: Tue, 31 Oct 2006 15:36:05 -0500
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
- References:
- OT: a problem about text manipulation
- From: Paul Smith
- Re: OT: a problem about text manipulation
- From: Benjamin Franz
- Re: OT: a problem about text manipulation
- From: Joe Klemmer
- Re: OT: a problem about text manipulation
- From: Benjamin Franz
- Re: OT: a problem about text manipulation
- From: Benjamin Franz
- OT: a problem about text manipulation
- Prev by Date: Re: Caching updates locally
- Next by Date: Re: Custom kernel rebuild fails for kernel-2.6.18-1.2798
- Previous by thread: Re: OT: a problem about text manipulation
- Next by thread: Re: OT: a problem about text manipulation
- Index(es):
Relevant Pages
|