Timeline for sed command does not work with find -exec?
Current License: CC BY-SA 4.0
11 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 18, 2020 at 19:17 | comment | added | Kusalananda♦ | @Herdsman You only get output with sed -n if you use the p command or the /p flag with the s command. Results of substitutions are not printed automatically (not with -n and not without -n). Also, you are clearly not running the commands that you show as the given command with locate would not replace 2 with 3 in the file that you show. | |
| May 18, 2020 at 16:55 | vote | accept | Herdsman | ||
| May 18, 2020 at 0:02 | comment | added | Theophrastus | could you try it without single quotes around the curly brackets? | |
| May 17, 2020 at 23:59 | answer | added | ckujau | timeline score: 1 | |
| May 17, 2020 at 20:51 | comment | added | Herdsman | @Freddy that is not true, it suppresses pattern space, not any ouput, It should display matched substitution. So wihout -n it outputs every line, but the lines are not still substitued. This is not solution | |
| May 17, 2020 at 20:47 | comment | added | Freddy | Remove the -n, it suppresses any output. And you don't need to escape | if you use -E. | |
| May 17, 2020 at 20:44 | comment | added | Herdsman | still does not work: sudo find / -name config.yml -exec sed -En '/swipe\|pinch/s/[0-9]/3/' '{}' \+ . I will add -i once I would see it substitued correctly but for now, do not even substitued | |
| May 17, 2020 at 20:40 | comment | added | Freddy | Change | to \| or add option -E, add option -i if you want to edit in-place, remove -n and you don't need to escape +. | |
| May 17, 2020 at 20:34 | comment | added | Herdsman | from man sed: ` -n, --quiet, --silent suppress automatic printing of pattern space` | |
| May 17, 2020 at 20:30 | comment | added | fra-san | Why is there a -n in your -exec-run sed? | |
| May 17, 2020 at 20:23 | history | asked | Herdsman | CC BY-SA 4.0 |