help-recutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: recfmt tabular output returns one record only


From: Wu Ming
Subject: Re: recfmt tabular output returns one record only
Date: Fri, 3 Nov 2023 15:17:18 +0800

recutils v1.9

recins -f “Dir" -v “$dir" -t "Checks” recfile.rec

is an example. Used the same for all fields of the same record identified by 
Dir.

But then realised recins creates no relationship between fields. I was just 
adding records. Marked by an empty line in between them.

By using recset instead:

recset -t "Checks" -e "Dir=123" -f "html" -a "128k” recfile.rec

.rec looks like yours:

%rec: Checks

Dir: 123
html: 128k

Dir: 456

fields of the same record grouped together. Now recfmt should work as expected.

> On 3 Nov 2023, at 14:55, Rowan Wookey <admin@rwky.net> wrote:
> 
> Can you provide the recset command you used? And the version of recutils?
> 
> On 02/11/2023 23:30, Wu Ming wrote:
>> Thanks.
>> This is a surprise. Records were inserted with recins and recset so I did 
>> not add additional newlines myself.
>> If .rec is:
>> %rec: Tot
>> CSV: 36
>> HTML: 2
>> %rec: Checks
>> Dir: 19112
>> Name: First
>> html: 128K
>> Dir: 2375
>> Name: Second
>> html: 124K
>> it still works.
>> If .rec is instead:
>> %rec: Tot
>> CSV: 36
>> HTML: 2
>> %rec: Checks
>> Dir: 19112
>> Name: First
>> html: 128K
>> Dir: 2375
>> Name: Second
>> html: 124K
>> it won’t. recsel will return empty.
>> I have chosen .rec for not having to deal with separators anymore. Do I need 
>> to avoid recset and recinst for recfmt to work instead?
>>> On 3 Nov 2023, at 13:26, Rowan Wookey <admin@rwky.net> wrote:
>>> 
>>> The new lines in the check.rec are counted as part of the filed. If you 
>>> remove these lines it will work for example if you change your check.rec to:
>>> 
>>> %rec: Tot
>>> 
>>> CSV: 36
>>> HTML: 2
>>> 
>>> %rec: Checks
>>> 
>>> Dir: 19112
>>> Name: First
>>> html: 128K
>>> 
>>> Dir: 2375
>>> Name: Second
>>> html: 124K
>>> 
>>> It will output:
>>> 
>>> recsel -t Checks check.rec |  recfmt -f template.txt
>>> 19112 First 128K
>>> 2375 Second 124K
>>> 
>>> 
>>> On 02/11/2023 21:06, Wu Ming wrote:
>>>> recsel -C -t Checks check.rec | recfmt -f template.txt
>>> 
>>> 
>>> 
> 
> -- 
> Regards
> 
> Rowan Wookey MSc Comp (Open), CISMP
> Server Administrator & Programmer
> 
> Please add admin@rwky.net to your contacts/email whitelist.
> My GPG key https://www.rwky.net/admin_at_rwky.net.sig
> My SSH key https://www.rwky.net/id_rsa.pub
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]