0

I'm about to use sed 's/a/b/' *ex/config/abs.json. by default it shows me all modifications but I want to know which files it would modify.

Something like

... 
a1ex/config/abs.json
a2ex/config/abs.json
b177ex/config/abs.json
...

closed as unclear what you're asking by Michael Homer, Prvt_Yadv, muru, Stephen Harris, msp9011 Apr 15 at 5:51

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

1

The command

sed 's/a/b/' *ex/config/abs.json

would not modify any files. It would read the contents of all the files whose names matches the given pattern, but since you don't write the changes back into the files (you don't use -i for example), there is no persistent modification made to the contents of the files.

To see what fils would have been modified, had you used sed -i (assuming you are using GNU sed), you should first run

grep -l 'a' *ex/config/abs.json

This would output the pathnames of the files that contains the letter a and that therefore would be modified by the sed expression s/a/b/ if an in-place edit was made.

  • i expected some option to sed to see the changes, never thought of using grep. Thank you. – Illiax Apr 15 at 14:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.