[EMAIL PROTECTED] am Freitag, 9. Februar 2007 14:21:
> How do I get these two into one one liner?
>
> Obviously, semicolon, but I want to operate on the file
> all over again without using tmp files.

[1]
> cp /net/u/1/v/vjp2/weco.txt /net/u/1/v/vjp2/junk.tmp

[2]
> cat /net/u/1/v/vjp2/junk.tmp | perl -n00e'tr/\t\r\n/ /; \
> print "$1\n" while s/^(.{0,36}\S)\s+//; \
> print "\n"' > /net/u/1/v/vjp2/junk2.tmp 

[3]  
> cat /net/u/1/v/vjp2/junk2.tmp | perl -pe 'if ($.%4==2) {$_ .= \ 
> qq(\n).(q(-) x 37).qq(\n)} elsif ($.%4==0) \
> {$_ .= qq(\n).(q(=) x 37).qq(\n)} else {$_ .= qq(\n)};'


The lines [2] and [3] contain the answer to your question: Intermediate files 
can be replaced by using a pipe (|).

So, instead of writing to a file via redirection (>) in [1] and then catting 
this file again in [2], use a pipe.

What's done in [1] seems superfluous to me; you can start with weco.txt 
directly.

Personally, I don't think it's the best idea to start using perl by playing 
perl golf...

Hope this helps

Dani

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to