Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to convert a batch of latex files using catdvi.

The command I use for a single file is:

catdvi -e 1 -U 1.dvi | sed -re "s/\[U\+2022\]/*/g" | sed -re "s/([^^[:space:]])\s+/\1 /g" > 1.txt

However, I want to run the same command on all files from 1.dvi to 30.dvi. When I did:

for f in *.dvi ; do catdvi -e 1 -U $f | sed -re "s/\[U\+2022\]/*/g" | sed -re "s/([^^[:space:]])\s+/\1 /g" > "${f%.dvi}.txt"; done;

It gives an error expecting 0 or 1 arguments, got 10, etc.

What change do I need to do to the command?

share|improve this question
up vote 0 down vote accepted

The answer to a similar question will apply to here also. So, here is the link:

Batch command that requires output redirection

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.