tech-userlevel archive

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

Re: Proposal: Add option to add dates to write(1)



Hi,

>  > The following function would do the work:
>  > 
>  > prependate()
>  > {
>  >   while true; do
>  >     read line
>  >     s=$(date +"${1:-%X %x: }")
>  >     echo "$line" | awk "{ sub(\"^\", \"$s\"); print; fflush }"
>  >   done
>  > }
> 
> prependate() { awk '{ printf "%s %s\n", strftime("%x %X"), $0; fflush; }' }
ok, I consider myself beaten.

>  > Anyway, with comments, error handling, proper indenting, etc., you won't
>  > end up with thaat much less lines than in C.
> 
> Buncombe. :-)
With shebang, comment and breaking, you end up with appr. seven lines.
I consider this a linear factor compared to 50. ;-)

Regards, Julian

Attachment: signature.asc
Description: PGP signature



Home | Main Index | Thread Index | Old Index