a perl question
Joachim Backes
joachim.backes at rhrk.uni-kl.de
Tue Jan 4 11:05:29 UTC 2011
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?
Kind regards
--
Joachim Backes <joachim.backes at rhrk.uni-kl.de>
http://www.rhrk.uni-kl.de/~backes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6131 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.fedoraproject.org/pipermail/users/attachments/20110104/7d8433f9/attachment.bin
More information about the users
mailing list