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
...
Illiax
  • 125
  • 1
  • 5
  • 5
    That command doesn't modify any files (and `sed` doesn't tell you what files it's dealing with). What is your actual command, and is it changing files the way you expect? You can [edit] your question. – Michael Homer Apr 12 '19 at 23:12
  • 1
    https://unix.stackexchange.com/questions/97297/how-to-report-sed-in-place-changes? – muru Apr 13 '19 at 06:28

1 Answers1

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.

Kusalananda
  • 320,670
  • 36
  • 633
  • 936