Re: OT: a problem about text manipulation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 31 Oct 2006, Benjamin Franz wrote:

> 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" }
> 
> :)))

Darn it, now you have me playing Perl Golf (last one, promise):

#!/usr/bin/perl -na

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

-- 
Benjamin Franz

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux