How to know % of read file in cat?

Polytropon freebsd at edvax.de
Sat Mar 9 10:41:38 UTC 2013


On Sat, 9 Mar 2013 10:54:00 +0100, Eduardo Morras wrote:
> 
> Hello,
> 
> I use cat to read a file and pass it to another app, the command is this:
> 
> camibar% cat file.git | fossil import --git file.fossil
> 
> It takes a lot of time, file.git is 12GB, and i want to know if
> there's some 'magic' trick can I use to show me how many bytes
> or the % of the file.git cat sent to the other app.
> 
> Maybe cat isn't the correct tool?

Your example could be considered a "useless use of cat",
because you could have used the < redirection instead.
However, if the _actual_ program you're running, fossil,
has an option for a verbose output or progress indicator,
I would suggest using this (maybe "man fossil" lists
something like -v).

There are also tools that act on SIGINT or SIGINFO.
This signal can be sent by pressing Ctrl-T. Maybe fossil
also outputs a status message?

Offering a percentage of how much of a file has been read
would imply knowledge about the size of the file. The
construct cat | fossil does not provide fossil with that
information or even the file name in question. But obtaining
the amount of data processed should be possible somehow.


PS.
cat-less command: fossil import --git file.fossil < file.git


-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list