[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: feature requests: trunc and maybe cmddiff
From: |
Pádraig Brady |
Subject: |
Re: feature requests: trunc and maybe cmddiff |
Date: |
Tue, 10 Mar 2009 15:06:40 +0000 |
User-agent: |
Thunderbird 2.0.0.6 (X11/20071008) |
Rafal Maszkowski wrote:
> I wonder if a wrapper around the system trunc(3) call could be included
> into coreutils. It could be a separate command like:
>
> trunc my_file 234M
>
> (I have made such for myself) or maybe an extension to the touch
> comand syntax. The command can shorten an existing file or create a
> sparse new file.
That has already been added.
The syscall is "truncate" BTW, and usage of the new util is:
truncate -s234M my_file
> There is another command (script) I created some 10 years ago and I used
> to use it frequently. The main purpose of it is estimating the ending
> time of big and slow file copying. It can base the estimate on a number
> contained in some row and field of e.g. du or df output. The output
> of the traced command is saved every time cmddiff is called. The
> output is kept in an RCS file in $HOME. The consecutive runs of cmddiff
> can check different fields of the same traced command. This one is
> probably more suitable for moreutils.
>
> address@hidden:/tmp,0# cmddiff -h
> cmddiff - command output tracer
>
> example:
> cmddiff -f 2 -e 137000 -p -r 1.6 'wc -l addr.resolved'
> -f 1 compare 1st field in 1st line; general form: line.field
> -e 137000 calculate when the field is going to reach this value
> -p do not append path to the characteristic command string
> -r 1.6 compare with revision 1.6, default: 0 == 1.1, -1 means the
> previous one
> 'wc ...' the command
I'm not sure about this.
Note there have been a few patches to add progress bars to cp/mv. For e.g.:
http://lists.gnu.org/archive/html/bug-coreutils/2007-12/msg00212.html
However you can use `rsync -aP my_file my_file.2` to copy locally with progress.
Also note the `pv` util for a more general progress tool:
http://www.ivarch.com/programs/quickref/pv.shtml
cheers,
Pádraig.