This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
os_cp:redirects_pipes [2025/03/26 15:44] jkonczak |
os_cp:redirects_pipes [2025/04/07 21:07] (current) jkonczak added examples |
||
|---|---|---|---|
| Line 173: | Line 173: | ||
| ~~Exercise.#~~ Redirect standard output and the standard error of the ''find /var/spool/'' command to the same file. | ~~Exercise.#~~ Redirect standard output and the standard error of the ''find /var/spool/'' command to the same file. | ||
| + | |||
| + | ++++ Examples | {{page>so:redirects:out-en&inline}} ++++ | ||
| === Input redirections === | === Input redirections === | ||
| Line 201: | Line 203: | ||
| ~~Exercise.#~~ Use ''bc'' to calculate ''sqrt(2.0000)'' in non-interactive mode and redirect its output to a file. | ~~Exercise.#~~ Use ''bc'' to calculate ''sqrt(2.0000)'' in non-interactive mode and redirect its output to a file. | ||
| + | |||
| + | ++++ Examples | {{page>so:redirects:in&inline}} ++++ | ||
| <small> | <small> | ||
| Line 335: | Line 339: | ||
| \\ Then repeat the commands, running the ''ps'' before the ''fold''. | \\ Then repeat the commands, running the ''ps'' before the ''fold''. | ||
| </small> | </small> | ||
| + | |||
| + | ++++ Examples | {{page>so:redirects:pipes1-en&inline}} ++++ | ||
| ===== Filters ===== | ===== Filters ===== | ||
| Line 363: | Line 369: | ||
| ~~Exercise.#~~ Run ''seq 25 > //file//''. Then run ''tail -f //file//'' in one | ~~Exercise.#~~ Run ''seq 25 > //file//''. Then run ''tail -f //file//'' in one | ||
| terminal and append (with output redirection) some data to //file//. | terminal and append (with output redirection) some data to //file//. | ||
| + | |||
| + | ++++ Examples | {{page>so:pipes_filters:head_tail&inline}} ++++ | ||
| ==== grep ==== | ==== grep ==== | ||
| Line 409: | Line 417: | ||
| \\ | \\ | ||
| List all files containing ''ecdsa'' in ''~/.ssh''. | List all files containing ''ecdsa'' in ''~/.ssh''. | ||
| + | |||
| + | ++++ Examples | {{page>so:pipes_filters:grep&inline}} ++++ | ||
| ==== cut ==== | ==== cut ==== | ||
| Line 430: | Line 440: | ||
| ''egrep '^[Ee]{2}' /usr/share/myspell/en_US.dic'' a slash and all that follows | ''egrep '^[Ee]{2}' /usr/share/myspell/en_US.dic'' a slash and all that follows | ||
| it. | it. | ||
| + | |||
| + | ++++ Examples | {{page>so:pipes_filters:cut-en&inline}} ++++ | ||
| ==== sort ==== | ==== sort ==== | ||
| Line 474: | Line 486: | ||
| ~~Exercise.#~~ Sort the file by the second column (alphabetically) and by the third column (numerically). | ~~Exercise.#~~ Sort the file by the second column (alphabetically) and by the third column (numerically). | ||
| </small> | </small> | ||
| + | |||
| + | ++++ Examples | {{page>so:pipes_filters:sort&inline}} ++++ | ||
| ==== wc, uniq, nl ==== | ==== wc, uniq, nl ==== | ||
| Line 506: | Line 520: | ||
| \\ | \\ | ||
| Then pipe it through ''sort'' and ''uniq'' so that you see how many times each result was hit. | Then pipe it through ''sort'' and ''uniq'' so that you see how many times each result was hit. | ||
| + | |||
| + | ++++ Examples | {{page>so:pipes_filters:wc_uniq&inline}} ++++ | ||
| <small> | <small> | ||
| Line 540: | Line 556: | ||
| * to squeeze all spaces | * to squeeze all spaces | ||
| * remove all the letters ''rwx'' | * remove all the letters ''rwx'' | ||
| + | |||
| + | ++++ Examples | {{page>so:pipes_filters:tr-en&inline}} ++++ | ||
| <small> | <small> | ||