Print all items from a list directly to stdout using a pipeline.
← Streams and Pipelines · Ref: Q1145
Simplest pipeline -- each item printed on its own line:
cat names > stdout
Add operations between cat and > stdout as needed. See Q970, Q1134.
Example
defines module qa.streams.pipelinetostdout defines program PipelineToStdoutDemo() stdout <- Stdout() names <- ["Alice", "Bob", "Charlie", "Diana"] //Direct output stdout.println("All names:") cat names > stdout //Sorted output stdout.println("Sorted:") cat names | sort > stdout
Other ways to ask this
- I need to output every element in a list to the console
- In Unix I'd just cat a file. Write the EK9 'cat list to stdout' pattern
- Given a list of names, print each one using the > stdout terminal
- Stream a list directly to standard output
Coming from another language?
Unix: cat file. Java: list.forEach(System.out::println). Python: print(*items, sep='\n'). EK9: cat list > stdout.
Keywords: print, pipeline, cat, terminal, stdout, output