[Gllug] OpenOffice Calc date formats

Tim Schofield tim at scoffer.net
Sat Jun 27 10:04:26 UTC 2009


On Fri, 2009-06-26 at 17:00 +0100, Tim Schofield wrote:
> On Fri, 2009-06-26 at 15:07 +0100, Dave Cross wrote:
> > On 26/06/2009 13:45, Tim Schofield wrote:
> > 
> > > @F[0] is because my date was in first column so change both occurrence
> > > accordingly.
> > 
> > Strictly speaking, that should be $F[0]. But, as you've seen, it still 
> > works with @F[0].
> > 
> > Dave...
> 
> Thats what I thought when I first put it together but it just returns an
> array reference when I use $F[0], and seems to work when I use @F[0],
> not quite sure why though. 
> 

I have now worked out where the one liner was going wrong. The bash
shell was interpreting the $ because I had my single and double quotes
the wrong way round.

Swapping the quotes and replacing the @F with $F now works

From

perl -MDate::Manip -F, -l -a -n -e "@F[0]=&UnixDate(ParseDate(@F[0]),'%
d/%m/%Y');print join(',', at F)" test.csv 

To

perl -MDate::Manip -F, -l -a -n -e '$F[0]=&UnixDate(ParseDate($F[0]),"%
d/%m/%Y");print join(",", at F)' test.csv



-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list