Stream: helpdesk (published)

Topic: ✔ run(`cat file.txt >> out.txt`) ?


view this post on Zulip Leandro Martínez (Feb 16 2024 at 14:45):

How can I run the equivalent of a cat for appending a file to another, from within Julia? The run(pipeline(cat file.txt, stdout="out.txt")) option overwrites the output file.

view this post on Zulip Sebastian Pfitzner (Feb 16 2024 at 14:48):

shell> cat foo.txt
hi

julia> open("foo.txt", "a") do io
         run(pipeline(`ls -la`, stdout=io))
       end
Process(`ls -la`, ProcessExited(0))

shell> cat foo.txt
hi
total 568
drwxr-xr-x  13 pfitzseb pfitzseb   4096 Feb 16 15:46 .
drwxr-xr-x 127 pfitzseb pfitzseb   4096 Dec 11 12:40 ..
-rw-r--r--   1 pfitzseb pfitzseb  71659 Feb 14 15:04 CHANGELOG.md

view this post on Zulip Leandro Martínez (Feb 16 2024 at 15:37):

Thanks!

view this post on Zulip Notification Bot (Feb 16 2024 at 15:38):

Leandro Martínez has marked this topic as resolved.


Last updated: Nov 22 2024 at 04:41 UTC