I have two aux files attached to my LaTeX document : aux_1 and aux_2. I would like, at some point, to copy the content of aux_1 to aux_2.

More precisely, the file aux_1 does already contain some text. I want to copy the content of aux_2 after the already existing text.

Is it possible to do it ? I use the newfile package to deal with the aux files.

PS : If possible, I would like a LaTeX-friendly answer :)

1 Answer 1

\write18{cp aux_1 aux_2}

(On Windows, use copy instead, I think.)

  • 2
    \immediate\write18 if the command needs to be performed at a precise moment; without \immediate it will be deferred to the next shipout operation (that might never happen).
    – egreg
    Oct 14, 2011 at 9:29
  • @egreg: Good advice, though that makes my answer more serious than I intended it. I'm just pushing my "why do that in LaTeX when you have a perfectly good OS instead" angle on excessive TeX programming.
    – Ryan Reich
    Oct 14, 2011 at 14:45
  • 1
    I suspect that your proposition will overwrite aux_1 to aux_2.
    – Colas
    Oct 18, 2011 at 15:56
  • 1
    @Colas: Yes, it will. You can use a different operating system utility that will append them, e.g. cat, if you want that. As I said, my point is that this is not a TeX task and the solution is to use \write18 to farm it out to the system.
    – Ryan Reich
    Oct 18, 2011 at 16:38
  • Thanks ! I understand that I do strange things, sorry about that :)
    – Colas
    Oct 18, 2011 at 16:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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