On Thursday, May 5, 2016 at 10:24:13 PM UTC+2, Martin Michlmayr wrote:
>
> * dim <[email protected] <javascript:>> [2016-05-04 12:36]:
> > I agree, but we have a file with about 2000 entries without commodities
> and
> > the question is if it is possible to run a ledger command with some
> option
> > and print the exact same file but this time with commodity € added to
> each
> > amount. Something like: ledger print --commodityoption '€' > newfile.dat
> > After that we would use the newfile.dat as ledger file, with all amounts
> in
> > € and get rid of the original file.
>
> Why don't you use something like Perl to modify the ledger files?
>
e.g.
>
> perl -pi -e "s/(\s+)(\d+\.\d+)$/\$1 € \$2/" *.ledger
>
>
>
Thanks, very nice. This was my amateur attempt this evening,
#!/usr/bin/perl
while (<>)
{
$_ =~ s/(^\s+[^;]\s+.+\:.+\s+)(\-*[0-9]+\.*[0-9]*)(\s*$)/$1 € $2 $3/g;
print $_;
done;
}
--
---
You received this message because you are subscribed to the Google Groups
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.