1

I've got a bunch of pdf files that are joined with a very long command line sitting in a directory. Some are in English and some are in French, differentiated by _e.pdf and _f.pdf.

Because they're joined in a specific order the command line can't be shortened, but I'd like to modify and re-execute it, simply replacing _e by _f. How can I use sed (or other) for this?

Let's say the command is

pdfjoin file1_e.pdf file2_e.pdf file3_e.pdf 

and in history it's command 10.

I've got as far as

echo !10 | sed 's/_e.pdf/_f.pdf/g'

which echoes the command I want to run. But I actually want to run that, not just display the command.

2 Answers 2

5

Have you tried backticks?

`echo !10 | sed 's/_e.pdf/_f.pdf/g'`

Though I can't help feeling that you should be using make.

0

By the way GNU sed has more interesting trick to execute commands:

echo !10 | sed 's/_e.pdf/_f.pdf/ge'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .