Re: a perl question

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

 



On Tue, 04 Jan 2011 12:05:29 +0100, Joachim wrote:

> On 01/04/2011 11:27 AM, S Mathias wrote:
> > cat asdf.txt
> > bla-bla
> > bla-bla
> > bla[XYZ]
> > importantthing
> > another important thing
> > [/XYZ]
> > bla-bla
> > bla-bla
> > [XYZ]
> > yet another thing
> > hello!
> > [/XYZ]
> > bla-bla
> > etc.
> > $ SOMEPERLMAGIC asdf.txt > output.txt
> > $ cat output.txt
> > importantthing
> > another important thing
> > yet another thing
> > hello!
> > 
> > 
> > how can i sovle this question? what is SOMEPERLMAGIC? are there any perl gurus, that have a little spare time?
> > 
> > Thank you! :\
> > 
> > 
> >       
> 
> Hi,
> 
> suppose the input data are saved in the file x.
> Then this little command line could help:
> 
>  perl -e 'while (<>) {/thing|hello/ && print}'<x
> 
> resp. create an executable file thing.pl with 2 lines
> 
> #!/usr/bin/perl
> while (<>) {/thing|hello/ && print}
> 
> and call
> 
> thing.pl <x
> or
> cat x|./thing.pl
> 
> This is you needed?

Very likely not. As I understand it, he wants a Perl script to filter
out arbitrary text between the opening and closing tags [XYZ] â [/XYZ].
It doesn't need a Perl "guru" to program something like that, but it's
a little bit of an exercize for somebody who wants to start programming
in Perl.
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines


[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux