Timeline for Execute a command once per line of piped input?
Current License: CC BY-SA 3.0
16 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Aug 27, 2018 at 22:20 | history | rollback | Anthony Geoghegan |
Rollback to Revision 3
|
|
| S Aug 27, 2018 at 16:45 | history | suggested | Chris Stryczynski | CC BY-SA 4.0 |
fixed the answer
|
| Aug 27, 2018 at 11:18 | review | Suggested edits | |||
| S Aug 27, 2018 at 16:45 | |||||
| Jun 12, 2017 at 16:09 | comment | added | SAm | I've found bash's powershell's equivalent to %{ command $_ } ! | |
| Aug 17, 2016 at 12:48 | comment | added | Harry |
Alternatively to @Vardhan's suggestion you can use find's -print0 option with | xargs -0, instead of piping through tr '\n' '\0'
|
|
| Nov 2, 2015 at 18:03 | history | rollback | Jeff Schaller♦ |
Rollback to Revision 1
|
|
| S Nov 2, 2015 at 16:39 | history | suggested | rogerdpack | CC BY-SA 3.0 |
actually run it once per line
|
| Nov 2, 2015 at 14:49 | review | Suggested edits | |||
| S Nov 2, 2015 at 16:39 | |||||
| Jun 30, 2015 at 16:08 | comment | added | Michael Goldshteyn | If you want to see the proper way to do this with xargs, see my answer below. | |
| Mar 29, 2013 at 16:55 | review | Suggested edits | |||
| Mar 29, 2013 at 17:26 | |||||
| Feb 17, 2011 at 18:17 | comment | added | mattdm | like, "the specific circumstances which give the right answer to the question". :) | |
| Feb 17, 2011 at 14:27 | vote | accept | Xodarap | ||
| Feb 17, 2011 at 11:12 | comment | added | vrdhn | ... | tr '\n' '\0' | xargs -0 | |
| Feb 17, 2011 at 5:25 | comment | added | Keith | @Jander The question was rather general, so I gave the general tool. True, you will have to adjust its behavior with options depending on the specific circumstances. | |
| Feb 17, 2011 at 5:17 | comment | added | Jander |
Not quite. printf "foo bar\nbaz bat" | xargs echo whee will yield whee foo bar baz bat. Maybe add the -L or -n options?
|
|
| Feb 17, 2011 at 4:58 | history | answered | Keith | CC BY-SA 2.5 |