a perl question

2011-01-04 Thread S Mathias
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! :\


  
-- 
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines


Re: a perl question

2011-01-04 Thread Larry Brower
You haven't asked a question. Also, this is not a perl mailing list. You keep 
sending messages asking how to do things instead of doing your own research. We 
are not Google, but I hear if you actually use Google and do things for 
yourself once and a while you will magicaly get answers.



Connected by MOTOBLURâ„¢ on T-Mobile

-Original message-
From: S Mathias smathias1...@yahoo.com
To: users@lists.fedoraproject.org
Sent: Tue, Jan 4, 2011 04:27:35 CST
Subject: a perl question

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! :\


  
-- 
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
-- 
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines


Re: a perl question

2011-01-04 Thread Joachim Backes
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.bac...@rhrk.uni-kl.de

http://www.rhrk.uni-kl.de/~backes



smime.p7s
Description: S/MIME Cryptographic Signature
-- 
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines


Re: a perl question

2011-01-04 Thread Michael Schwendt
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@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines


Re: a perl question

2011-01-04 Thread Dave Cross
On 4 January 2011 10:27, S Mathias smathias1...@yahoo.com 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?

It looks like you need something a bit like this.

  #!/usr/bin/perl

  use strict;
  use warnings;

  while () {
if (m|\[XYZ]| .. m|\[/XYZ]|) {
  next if m|\[/?XYZ]|;
  print;
}
  }

But I can't be sure as you haven't actually explained what you question is.

For Perl questions, you might be better advised to try Stack Overflow
or your local Perl Mongers group.

Dave...

-- 
Dave Cross :: d...@dave.org.uk
http://dave.org.uk/
@davorg
-- 
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines


Re: a perl question

2011-01-04 Thread Thomas Cameron
On 01/04/2011 04: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?

Seriously, Mathias.  These look like questions straight out of entry 
level university classes.  Are you asking mailing lists to do your 
homework for you?

Not cool at all.

TC
-- 
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines


Re: a perl question

2011-01-04 Thread John Haxby
On 4 January 2011 14:27, Thomas Cameron thomas.came...@camerontech.comwrote:


 Seriously, Mathias.  These look like questions straight out of entry
 level university classes.  Are you asking mailing lists to do your
 homework for you?

 Not cool at all.



Especially as your supervisor may well be lurking on lists to see who is
trying to get other people to do their assignments!

jch
-- 
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines


tricky perl question - ascending order

2010-05-23 Thread Jozsi Vadkan
or maybe in bash..
script/one liner e.g.: input: http://pastebin.com/raw.php?i=pMZPEsMZ

i want to make this output from it:
http://pastebin.com/raw.php?i=kH8VxT0A


So from the input, i want to make an ascendant order, how many things
are under a SOMETHING-XX

Does anyone has any perl magic in the pocket, how to do this? :D

Thank you very, very much..:\

-- 
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines


Re: tricky perl question - ascending order

2010-05-23 Thread Sam Varshavchik

Jozsi Vadkan writes:


or maybe in bash..
script/one liner e.g.: input: http://pastebin.com/raw.php?i=pMZPEsMZ

i want to make this output from it:
http://pastebin.com/raw.php?i=kH8VxT0A


So from the input, i want to make an ascendant order, how many things
are under a SOMETHING-XX


You reversed your URLs.

perl -e 'while () { push @a, if /./  ($#a  0 || $a[$#a] =~ /\n\n$/s); 
$a[$#a] .= $_} print join(,sort @a);'




pgpNDh4dRrSMT.pgp
Description: PGP signature
-- 
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines


Re: tricky perl question - ascending order

2010-05-23 Thread Jozsi Vadkan
Please god, tell me, how does this magic work?

http://pastebin.com/raw.php?i=Cr6WzdGv

Thank you!!



 Jozsi Vadkan writes:
 
  or maybe in bash..
  script/one liner e.g.: input: http://pastebin.com/raw.php?i=pMZPEsMZ
  
  i want to make this output from it:
  http://pastebin.com/raw.php?i=kH8VxT0A
  
  
  So from the input, i want to make an ascendant order, how many things
  are under a SOMETHING-XX
 
 You reversed your URLs.
 
 perl -e 'while () { push @a, if /./  ($#a  0 || $a[$#a] =~ /\n\n$/s); 
 $a[$#a] .= $_} print join(,sort @a);'
 

-- 
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines


Re: tricky perl question - ascending order

2010-05-23 Thread Jozsi Vadkan
$ perl -e 'while () { push @a, if /./  ($#a  0 || $a[$#a] =~ /\n
\n$/s); $a[$#a] .= $_} print join(,sort @a);'  before.txt  after.txt
$ diff before.txt after.txt 
$

i don't get it, it doesn't work, am i missing something?

thank you

 Jozsi Vadkan writes:
 
  or maybe in bash..
  script/one liner e.g.: input: http://pastebin.com/raw.php?i=pMZPEsMZ
  
  i want to make this output from it:
  http://pastebin.com/raw.php?i=kH8VxT0A
  
  
  So from the input, i want to make an ascendant order, how many things
  are under a SOMETHING-XX
 
 You reversed your URLs.
 
 perl -e 'while () { push @a, if /./  ($#a  0 || $a[$#a] =~ /\n\n$/s); 
 $a[$#a] .= $_} print join(,sort @a);'
 

-- 
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines


Re: tricky perl question - ascending order

2010-05-23 Thread Jozsi Vadkan

The solution [from the FreeBSD mailing list]:

perl -00 -e 'print map $_-[0], sort { $a-[1] = $b-[1] } map [$_,
tr/\n//], '  before.txt  after.txt

Thank you!!


 or maybe in bash..
 script/one liner e.g.: input: http://pastebin.com/raw.php?i=pMZPEsMZ
 
 i want to make this output from it:
 http://pastebin.com/raw.php?i=kH8VxT0A
 
 
 So from the input, i want to make an ascendant order, how many things
 are under a SOMETHING-XX
 
 Does anyone has any perl magic in the pocket, how to do this? :D
 
 Thank you very, very much..:\
 

-- 
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines