> -----Original Message-----
> From: Aaron J Mackey [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 22, 2002 2:41 PM
> To: [EMAIL PROTECTED]
> Subject: a little shorter please?
> 
> 
> 
> I can't seem to get this any shorter: I want the second through the
> next-to-last elements of @F joined by " ", and then the last 
> item of @F.
> 
> perl -ape '$,=" ";s//>@F[1..$#F-1]\n$F[$#F]/'
> 
> or (no join, but same general idea):
> 
> perl -pe 's/\s+(\S+)$/\n$1/;s/^\S+\s+/>/;'

  perl -alpe '$_=">@F[1..$#F-1]\n$F[-1]"'

Btw, your two snippets have different outputs. I assumed that your second
one is correct :)

--Ala

Reply via email to