adding a filename into a data file

Tony Edwardson Tony.Edwardson at lchclearnet.com
Mon Nov 5 08:14:41 PST 2012


yes – you use –n with print or –p without print
perl –pe ‘$_ = “$ARGV $_”’

From: MiltonKeynes-pm [mailto:miltonkeynes-pm-bounces+tony.edwardson=lchclearnet.com at pm.org] On Behalf Of Hugh Gallagher
Sent: 05 November 2012 16:11
Cc: miltonkeynes-pm at pm.org
Subject: Re: adding a filename into a data file

> perl -npe 'print "$ARGV "' *

That's very neat. Am I wrong to say that the -n is superfluous because of the -p?

Just need to add stripping of the file extension and job done.

On 5 November 2012 16:00, Tom Hukins <tom at eborcom.com<mailto:tom at eborcom.com>> wrote:
On Mon, Nov 05, 2012 at 03:32:11PM +0000, Ant Mitchell wrote:
> perl -npe 'print "$ARGV "' *
Indeed.  In the spirit of "teach a man to fish", it's worth mentioning
that Perl mentions the "-npe" switches in its "perlrun" documentation
and the "$ARGV" variable in "perlvar".

You should find this documentation installed alongside perl, although
some Linux distributions like to cripple their installations and omit
it.  You can also find it on the Web at http://perldoc.perl.org/.

Tom
_______________________________________________
MiltonKeynes-pm mailing list
MiltonKeynes-pm at pm.org<mailto:MiltonKeynes-pm at pm.org>
http://mail.pm.org/mailman/listinfo/miltonkeynes-pm



A copy of the LCH.Clearnet e-mail disclaimer can be found at: www.lchclearnet.com/disclaimer/email  

LCH.Clearnet Limited, Registered Office: Aldgate House, 33 Aldgate High Street, London EC3N 1EA. 
Recognised as a Clearing House under the Financial Services & Markets Act 2000. Reg in England No.25932.
LCH.Clearnet SA, Siège Social, 18 rue du Quatre Septembre, 75002 Paris, Chambre de Compensation conformément au Code Monétaire et Financier.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/miltonkeynes-pm/attachments/20121105/4a21ecd5/attachment.html>


More information about the MiltonKeynes-pm mailing list