Re: How to obtain the unrar overall progress report?

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

 



On Sun, 2008-09-14 at 07:05 -0700, Dan Thurman wrote:
> Patrick O'Callaghan wrote:
> >
> > On Sat, 2008-09-13 at 13:09 -0700, Dan Thurman wrote:
> > > # unrar x -ierr -o+ ~dant/Desktop/foo.rar \
> > >     | sed -e 's#\([0-9]\+\)[%]$#\1#'
> >
> > As I said, please send the output *without* enabling the 'sed' filter.
> >
> > Hint: use 'head', e.g.:
> >
> > # unrar x -ierr -o+ ~dant/Desktop/foo.rar| head 20 > capture
> >
> # unrar x -ierr -o+ ~dant/Desktop/foo.rar | head 20 >  capture
> head: cannot open `20' for reading: No such file or directory

Oops, should be "head -20"

> -rw-r--r-- 1 root root             0 2008-09-14 06:15 capture
> 
> # unrar x -ierr -o+ ~dant/Desktop/foo.rar | head -n 20 >  capture
> -rw-r--r-- 1 root root             0 2008-09-14 06:20 capture
> 
> # unrar x -ierr -o+ ~dant/Desktop/foo.rar 2>&1 | head -n 20 >  capture
> =====================================================================
> UNRAR 3.71 beta 1 freeware      Copyright (c) 1993-2007 Alexander Roshal
> 
> 
> Extracting from /home/dant/Desktop/foo.rar
> 
> Extracting  foo/cd1/Track01.flac     ^H^H^H^H  0%^H^H^H^H^H  OK  
> Extracting  foo/cd1/Track02.flac     ^H^H^H^H  0%^H^H^H^H  1%^H^H^H^H  
> 2%^H^H^H^H  3%^H^H^H^H  4%^H^H^H^H^H  OK  

The problem is that there are multiple progress numbers for each output
record. That's why the usual filters such as 'sed' are going to have a
hard time of it. You need to capture each number as it comes out and
process it (throwing away the ^H i.e. backspace characters) even though
you haven't seen a newline yet, because by the time you see the newline
the file has finished.

(This is a clear indication that the program was originally written for
a non-Unix environment, since the author just assumes that the progress
is for display on a terminal and not for filtering).

I'm not saying it's impossible, just nasty. You might be better tweaking
the source of unrar to give you more manageable output. You probably
can't distribute the result though (the license is freeware, not free).

poc

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux