Please note that LinuxExchange will be shutting down on December 31st, 2016. Visit this thread for additional information and to provide feedback.

Hi linux folks, How do I apply pv (http://www.ivarch.com/programs/pv.shtml) in cmp? for example when cmp -l a.iso b.iso It looks like a complicated case in pv.


asked 05 May '10, 19:17

dream's gravatar image

dream
111
accept rate: 0%

Please accept an answer, or provide more details so we can help.

(14 Jun '11, 11:37) rfelsburg ♦



It's not clear from your question what exactly is that you want to achieve.

pv is very similar to cat in its simpler form so you might have two different cases:

cmp a.iso b.iso | pv will process the output of the compare which might not give you an actual progress of the comparison task as the "result" could be empty (if the files are found to be the same) or much smaller than the actual original size of the compared files (given that you also don't know how big the result is going to be, it's impossible to compute the percentage...)

on the other hand pv a.iso | cmp - b.iso will use a little trick in order to read a.iso from the standard input and give you the progress of the file being fed to cmp

Haven't tried this myself but it should be the right way...

link

answered 12 May '10, 12:11

pmarini's gravatar image

pmarini
286216
accept rate: 28%

Try the following:

pv myfirstiso.iso | cmp -l mysecondiso.iso > output

The file "output" should contain the output of cmp afterwards, while the piping progress is correctly shown.

Edit: pmarini was faster. ;)

link

answered 12 May '10, 12:29

Jazz's gravatar image

Jazz ♦
7811312
accept rate: 33%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×90

Asked: 05 May '10, 19:17

Seen: 3,555 times

Last updated: 14 Jun '11, 11:37

powered by OSQA