File input/output: Difference between revisions
Content added Content deleted
m (Spelling/case, as in <http://en.wikipedia.org/wiki/Input/output>.) |
(jq) |
||
Line 1,361: | Line 1,361: | ||
even if something goes wrong during the read/write phase. |
even if something goes wrong during the read/write phase. |
||
<lang Julia>open(IO ->write(IO, open(readall, "file1", "r")), "file2", "w")</lang> |
<lang Julia>open(IO ->write(IO, open(readall, "file1", "r")), "file2", "w")</lang> |
||
=={{header|jq}}== |
|||
If the input file consists of ordinary lines of text, then the lines can be copied verbatim, one by one, as follows: |
|||
<lang jq>jq -M --raw-input --raw-output '. as $line | $line' input.txt > output.txt |
|||
</lang> |
|||
If the input consists of JSON, and if we wish to "pretty print" it, then the following will suffice:<lang jq> |
|||
jq -M '. as $line | $line' input.txt > output.txt |
|||
</lang> |
|||
=={{header|K}}== |
=={{header|K}}== |