HI Flo,

On Fri, Mar 18, 2011 at 10:44 AM, Florian Effenberger
<flo...@documentfoundation.org> wrote:
>
> Christian Lohmaier wrote on 2011-03-17 19.44:
>
>> Then please replace your ugly hack with this:
>
> hehe, thanks, this looks much better. My script was really, well... don't
> tell anyone. :-) Yours works nearly like a charm, except one issue - it
> doesn't seem to limit the depth of scanning.

? Cannot even tell from the mail you forwarded what you mean with this.

> I've forwarded you one example
> mail, where one subscription ID is added to the output...

If you mean the line
/var/spool/mlmmj/zh-tw.libreoffice.org/users/4/0/0 at the bottom, then
this is because there are spurious newlines in the script (I should
have attached it or used shorter lines....)

It is not some depth - the 4 and 0 and 0 are the subscription values I
do print them after the path delimited with /, since then the single
seperator is /, thus makes parsing it with awk easier.

 - in your script it is
print
"------[...]"

but it should be
print "-----------[...]"

The print with no argument doesn't insert an empty line, but just
prints the current inputline, i.e. what is to be parsed/processed by
awk.

Similar error is in the begin block, there you apparently added
another print to insert an empty line (but again without argument -
works here because in begin there is no line read, thus the output is
empty, but still not "nice") before the "table", but now the "-----"
is without any print at all.

So instead of the spurious "print <nothing>", just use \n in the
statement above and make sure no additional newlines are inserted:

#BEGIN { print  "Find below the mailing list statistics for '$(date -I)'"
#  print  "This e-mail has been automatically generated without human
interaction.\n"
#  printf "%40s %8s %8s %8s %8s\n", "Listaddress", "Normal", "Digest",
"Nomail", "Total"
#  print  
"----------------------------------------+--------+--------+--------+--------"
#  normal=0;    digest=0;  nomail=0 }
#{ printf "%40s %8d %8d %8d %8d\n", $6"@"$5, $7, $8, $9, $7+$8+$9
#  normal+=$7; digest+=$8; nomail+=$9 }
#END { print  
"----------------------------------------+--------+--------+--------+--------"
#  printf "%40s %8d %8d %8d %8d\n", "All lists", normal, digest,
nomail, normal+digest+nomail}'

Seperate lines flagged with "#" at the beginning.
Note the additional \n" on the second line to replace the empty
"print" that was there below,
note the additional "print" before the line that prints the
delimiter-lines in the begin block, and also note the removed
linebreak between "print" and "-----" in the end-block.
(that print statement was causing the line
/var/spool/mlmmj/zh-tw.libreoffice.org/users/4/0/0 to appear in the
output - that is just the last input line, and as mentioned print
without argument just prints the current input line.

ciao
Christian

-- 
E-mail to moderators+h...@documentfoundation.org for instructions on how to 
unsubscribe
List archives are available at 
http://listarchives.documentfoundation.org/www/moderators/
All messages you send to this list will be publicly archived and cannot be 
deleted

Reply via email to