command line – Merge a set of enumerated.pdf information into one .pdf

on

|

views

and

comments


For easy concatenation of PDF information, the utility pdfunite is about so simple as it will get. It is without doubt one of the utilities that include the Poppler PDF rendering library and could be put in with brew set up poppler. Additionally it is included within the poppler-utils package deal in Debian and Ubuntu and the poppler package deal in ArchLinux and Fedora for those who’re utilizing Linux.

The utilization is

pdfunite file1.pdf file2.pdf file3.pdf mergedfile.pdf

To course of all information with the extension “pdf” within the present listing within the order of string numerical worth if there aren’t any whitespaces in any of the information:

pdfunite $(ls -v *.pdf) output.pdf

And if there are likely whitespaces within the filenames, it will get a little bit extra sophisticated, however this could work:

(ls -v *.pdf; echo output.pdf) | tr n  | xargs -0 pdfunite

Rationalization:

  • ls invokes the ls out of your $PATH ignoring any aliases. This can be essential in case you’ve an aliased ls that reveals further info (like particular characters to indicate sure permissions). You can even simply use an absolute path to the ls executable, like /usr/bin/ls.
  • ls -v kinds the information in keeping with (model) numbers inside textual content
  • tr n replaces newlines with NULLs after every file
  • xargs -0 tells xargs to make use of the NULL character to separate arguments

As you may see, correct dealing with of issues like whitespace (and different particular characters) when piping instructions within the shell can get a little bit sophisticated. If you would like to learn extra, I like to recommend David Wheeler’s complete article.

Share this
Tags

Must-read

Constructing the Torc Driverless Security Case

At Torc, we’ve structured our security case on three foundational pillars: Engineer It to Be Secure, Function It to Be Secure, and the...

What’s DL+S? Unlocking the Huge Information Required to Develop Autonomous Vans

Breakthroughs in AI for autonomous driving don't occur in isolation. They occur when information, simulation, machine studying, infrastructure, and car testing work as...

Why I can’t wait to get right into a driverless automotive | Self-driving automobiles

Adrian Chiles (Driverless automobiles are taking us on a street to nowhere, 10 September) needs to know who requested for driverless automobiles. I...

Recent articles

More like this

LEAVE A REPLY

Please enter your comment!
Please enter your name here