pipeline(command)

pipeline(command; stdin, stdout, stderr, append=false)

Redirect I/O to or from the given command. Keyword arguments specify which of the command's streams should be redirected. append controls whether file output appends to the file. This is a more general version of the 2-argument pipeline function. pipeline(from, to) is equivalent to pipeline(from, stdout=to) when from is a command, and to pipe(to, stdin=from) when from is another kind of data source.

Examples:

  • run(pipeline(`dothings`, stdout="out.txt", stderr="errs.txt"))
  • run(pipeline(`update`, stdout="log.txt", append=true))

Examples

# Example 1: Creating a pipeline with commands
run(pipeline(`ls`, `grep xyz`))

# Example 2: Creating a pipeline with a command and a filename
run(pipeline(`ls`, "out.txt"))

# Example 3: Chaining multiple pipelines together
run(pipeline(pipeline(`ls`, `grep xyz`), "out.txt"))

In the first example, we create a pipeline by chaining the commands ls and grep xyz together. The output of the ls command is passed as input to the grep xyz command.

In the second example, we create a pipeline with the command ls and a filename "out.txt". The output of the ls command is redirected to the specified file.

In the third example, we chain multiple pipelines together. The output of the first pipeline (ls | grep xyz) is passed as input to the second pipeline, which appends the output to the file "out.txt".

The pipeline function allows you to create complex data processing pipelines by combining different commands, filenames, or results of other pipeline calls.

See Also

deserialize, eachline, eof, fd, flush, IOBuffer, ismarked, isopen, isreadonly, mark, nb_available, open, pipeline, position, read, read!, readavailable, readbytes, readbytes!, readline, redirect_stderr, redirect_stdin, reset, seek, seekend, seekstart, serialize, skip, skipchars, TextDisplay, unmark, write, writemime,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: