creating QIF file under Dos using AWK

Edward Doolittle edward.doolittle at gmail.com
Mon Mar 9 21:02:10 EDT 2015


The tenth field would be $10 .

On 9 March 2015 at 17:34, Edward Doolittle <edward.doolittle at gmail.com>
wrote:

> The fast hackish way to fix the regular expression would be to repeat the
> block "([^"]*)"; for as many times as there are fields, so for example to
> capture 10 active fields as you seem to have in your example the line would
> be
>
> if
> (/"([^"]*)";"([^"]*)";"([^"]*)";"([^"]*)";"([^"]*)";"([^"]*)";"([^"]*)";"([^"]*)";"([^"]*)";"([^"]*)";/)
> {
>
> Then the contents of the first field would be represented by $1, the
> second would be $2 ... hmm I don't know offhand what the 10th field would
> be. Let me look that up and get back to you.
>
> There are ways to make the regular expression more legible if you care
> about maintainability.
>
> HOWEVER, you should know that the regular expression fails if there is a "
> inside one of the fields. There *probably* won't be, but you don't know for
> certain. What you REALLY want is a Perl module called Text::CSV which is
> far more complex and robust than anything I can hack up sitting in front of
> my e-mail.
>
> On 9 March 2015 at 04:38, piggyb <piggybattery at gmail.com> wrote:
>
>> Thanks for the perl file
>> Can you tell me how I can use it on comma separated file?
>>
>>
>> "BANKnr12345";"31-12-2014";"EUR";"C";"25,50";"DEBAccount1234";"Bank";"01-01-2015";"Disciption";"Disciption";"";"";"";"";
>>
>> I have changed the line in to /if (/([^";"]*),([^";"]*),([^";"]*)/) {/ but
>> now only 11 rows get imported
>>
>>
>>
>> --
>> View this message in context:
>> http://gnucash.1415818.n4.nabble.com/creating-QIF-file-under-Dos-using-AWK-tp4676673p4676752.html
>> Sent from the GnuCash - User mailing list archive at Nabble.com.
>> _______________________________________________
>> gnucash-user mailing list
>> gnucash-user at gnucash.org
>> https://lists.gnucash.org/mailman/listinfo/gnucash-user
>> -----
>> Please remember to CC this list on all your replies.
>> You can do this by using Reply-To-List or Reply-All.
>>
>
>
>
> --
> Edward Doolittle
> Associate Professor of Mathematics
> First Nations University of Canada
> 1 First Nations Way, Regina SK S4S 7K2
>
> « Toutes les fois que je donne une place vacante, je fais cent mécontents
> et un ingrat. »
> -- Louis XIV, dans Voltaire, Le Siècle de Louis XIV, Chap. XXVI
>



-- 
Edward Doolittle
Associate Professor of Mathematics
First Nations University of Canada
1 First Nations Way, Regina SK S4S 7K2

« Toutes les fois que je donne une place vacante, je fais cent mécontents
et un ingrat. »
-- Louis XIV, dans Voltaire, Le Siècle de Louis XIV, Chap. XXVI


More information about the gnucash-user mailing list