I created a script to restore images. Now I would like to create a gauge (dialog) to show the progress. I can do "imagex --verbose", but that wil only show the files. I cant seem to capture the "%" during the process, only after is has been 100% written. Is there a way to "grep" the percentage when the imagex is in the process of writing the image.
The problem is that wimlib-imagex outputs a carriage return rather than a newline when it prints the informational lines containing the percentages you're interested in. This is intentional so that the output stays on the same line when used interactively, but if you pipe that output to 'grep' it won't distinguish between lines. You could work around this by piping the output to a command that translates carriage returns to newlines, for example:
wimapply test.wim dir | stdbuf -o L tr '\r' '\n' | grep '%'
That uses the tr program to do the translation. stdbuf (part of GNU coreutils) is needed to set the tr output to line-buffered.
Do note that you could instead write your own C or C++ program that uses wimlib directly. In that case, you could supply your own progress function to be called during the extraction.
Thank you!!!. It would take a lot longer to figure this out myself. I works!!! My script is now working with a progress bar!. Thank you.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.