adding a filename into a data file

Ant Mitchell ant at badmagic.com
Mon Nov 5 07:32:11 PST 2012


On 5 Nov 2012, at 15:05, Hugh Gallagher <hugh at hcgallagher.co.uk> wrote:

> Just for fun, I did it with some abuse of the default grep output and a bit of sed.
> 
> grep '.' * | sed 's/^\([^.]*\)\.[a-z]*:/\1 /'

Just for fun, this may not do what you think it does. For example just use one file, you won't get the output you want, or use files that don't have a three letter extension, or file that is named "a:bcd:xxx" etc.

The original question was fairly generic granted, but its not a general purpose solution. 

> 
> On 5 November 2012 14:37, Tony Edwardson <Tony.Edwardson at lchclearnet.com> wrote:
> or just
> while  (<>) {
>             print "$ARGV $_";
> }

or even: 
perl -npe 'print "$ARGV "' *

Gotta love more than one way !

--
Ant


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/miltonkeynes-pm/attachments/20121105/7f9b4140/attachment.html>


More information about the MiltonKeynes-pm mailing list