I have hundreds of sources codes files. I want to rename namespace according to the filenames path. Of course slashes must be replace by dots.
I have tried with find -exec but I failed to get the filename inside sed to replace the current namespace with the path.
find -type f -iname *.cs -exec sh -c 'x="{}"; sed -E "s/\//./; s/(namespace.Project).+/\1.$x/" {}' \;
But I get
sed: -e expression #1, char 36: unknown option to `s'
find -type f -iname *.cs
and then show us what you want to do to those files. Do you actually want to rename them? Do you just want to print them? Do you only want to change/
to.
? We can't really help unless you show us exactly what you need. – terdon May 22 '19 at 13:15