Re: unhead

2004-09-27 Thread Jed Davis
[EMAIL PROTECTED] (Randal L. Schwartz) writes: >> "Keith" == Keith C Ivey <[EMAIL PROTECTED]> writes: > > Keith> perl -pe '$_ x=!(1..5)' > > FWP. Not Golf. :) I had fun reading it, so --Jed

Re: unhead

2004-09-26 Thread Ian Phillipps
On Sat, 25 Sep 2004 at 19:09:31 -0700, Randal L. Schwartz wrote: > > "Keith" == Keith C Ivey <[EMAIL PROTECTED]> writes: > Well, it also presumes that "!" returns literally 0 and 1. I've > never seen a promise of that in any docs. > I think Perl6 should return "42" for true, just to keep peo

Re: unhead

2004-09-26 Thread Yitzchak Scott-Thoennes
On Sat, Sep 25, 2004 at 07:09:31PM -0700, "Randal L. Schwartz" <[EMAIL PROTECTED]> wrote: > Well, it also presumes that "!" returns literally 0 and 1. I've > never seen a promise of that in any docs. $ perl -we'use overload "!"=>sub{"whoa"}; print !bless{}' whoa > I think Perl6 should return "4

Re: unhead

2004-09-25 Thread Randal L. Schwartz
> "Keith" == Keith C Ivey <[EMAIL PROTECTED]> writes: Keith> Well, I'm sure there's something better than that for golf (Ton Keith> probably has a 3-byte solution), but I think x= with a boolean Keith> righthand side *is* fun, and it's even handy for one-liners Keith> occasionally once you'

Re: unhead

2004-09-25 Thread Keith C. Ivey
Randal L. Schwartz <[EMAIL PROTECTED]> wrote: > Keith> perl -pe '$_ x=!(1..5)' > > FWP. Not Golf. :) Well, I'm sure there's something better than that for golf (Ton probably has a 3-byte solution), but I think x= with a boolean righthand side *is* fun, and it's even handy for one-liners oc

Re: unhead

2004-09-25 Thread Randal L. Schwartz
> "Keith" == Keith C Ivey <[EMAIL PROTECTED]> writes: Keith> perl -pe '$_ x=!(1..5)' FWP. Not Golf. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical writing, C

Re: unhead

2004-09-25 Thread Keith C. Ivey
Randal L. Schwartz <[EMAIL PROTECTED]> wrote: > perl -ne 'print unless 1..5' perl -pe '$_ x=!(1..5)' -- Keith C. Ivey <[EMAIL PROTECTED]> Washington, DC

Re: unhead

2004-09-25 Thread Randal L. Schwartz
> "Jose" == Jose Alves de Castro <[EMAIL PROTECTED]> writes: Jose> You're probably all familiar with the commands "head" and "tail", which Jose> let you extract the first or the last N lines of input or a file... Jose> Imagine you want to print a file, but without the first N lines... Jose>

Re: unhead

2004-09-24 Thread Jasvir Nagra
We can also try clobbering the particular lines you don't want. Fr'instance for all but the first 5 lines perl -pe '$_=""if$.<=5' On Sat, 2004-09-25 at 02:17, Jose Alves de Castro wrote: > You're probably all familiar with the commands "head" and "tail", which > let you extract the first or the

Re: unhead

2004-09-24 Thread John Douglas Porter
I think we'd like to avoid solutions that involve loading entire file into an array, agreed? Here's how I'd do it: sed -n '5,$p' -- John Douglas Porter Josh Goldberg <[EMAIL PROTECTED]> wrote: > Here's a little oneliner to skip the first 5 lines of the file 'foo': > > perl -i5 -e '@_=;[

Re: unhead

2004-09-24 Thread Yitzchak Scott-Thoennes
On Fri, Sep 24, 2004 at 03:17:56PM +0100, Jose Alves de Castro wrote: > print if ($N+1)..0; Implicit comparison to $. only happens for constants, so that should be ($. > $N) .. 0

Re: unhead

2004-09-24 Thread Aaron J. Mackey
You mean 'tail +N' vs. 'tail -N' ? -Aaron On Sep 24, 2004, at 10:17 AM, Jose Alves de Castro wrote: You're probably all familiar with the commands "head" and "tail", which let you extract the first or the last N lines of input or a file... Imagine you want to print a file, but without the first N

Re: unhead

2004-09-24 Thread Josh Goldberg
Here's a little oneliner to skip the first 5 lines of the file 'foo': perl -i5 -e '@_=;[EMAIL PROTECTED]' < foo On Sep 24, 2004, at 7:17 AM, Jose Alves de Castro wrote: You're probably all familiar with the commands "head" and "tail", which let you extract the first or the last N lines of input or

Re: unhead

2004-09-24 Thread Eugene van der Pijll
Jose Alves de Castro schreef: > Imagine you want to print a file, but without the first N lines... > > For any N, maybe this: > > print if ($N+1)..0; > > Any thoughts? Any other ideas? What would be the best way to do this? I don't know about "best", but I rather like: 3...!print; to prin

unhead

2004-09-24 Thread Jose Alves de Castro
You're probably all familiar with the commands "head" and "tail", which let you extract the first or the last N lines of input or a file... Imagine you want to print a file, but without the first N lines... For N=1, one possibility would be: print if $. - 1; For any N, maybe this: print if ($