On Sat, 23 Oct 2004 00:32:09 +0200, Jenda Krynicky <[EMAIL PROTECTED]> wrote:
> From: Ken Wolcott <[EMAIL PROTECTED]>
> > What search string do I use on google or perldoc so that I know how to
> > display a specified range of lines from a file (like sed -n 24, 48p
> > filename)?

Have you considered 'man sed' ?

If printing lines 24 through 48 of a file is all you want, sed may in fact be
the better answer.  While 'perl' makes the impossible possible, it often
does the reverse when your problem is perfectly suited to a smaller tool..

You might want to be more specific in your question.   Were you after
a one liner to show off to the girls?  Something that ran faster than sed?
something which forms part of a larger application?   

Jenda gave excellent examples of one liners, possibly bordering on obfuscation
(how many people recognise a bi-stable flip flop when they see one?)

I have to admit, I use AWK and SED for one liners more often than perl,
since they are just plain fast...  

HTH
Cheers.
Dave

> 
> Whatever you like. I doubt you'll find anything.
> 
> > s2p no longer operates the way I used to use it back in perl 3x days
> > :-)
> >
> > man s2p really didn't help me understand what perl syntax would give
> > me the desired result that sed does :-(
> 
> I don't think there is any special syntax for this. Nor do I think
> there should be.
> 
> If you want to be cool you may use something like this, but I'd
> rather not.
> 
>        perl -p -e "$_ = '' unless $. == 24 .. $. == 48"
>        perl -p -e "$_ = '' unless $. >= 24;exit if $. >= 48"
> 
> Jenda
> ===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
> When it comes to wine, women and song, wizards are allowed
> to get drunk and croon as much as they like.
>        -- Terry Pratchett in Sourcery
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
> 
>

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


Reply via email to