Hello. I need to be able to run this sed command to all files named Object.obj in subfolders named Prop00 to Prop151 (hexadecimal) in the main folder convert. Please let me know if there is a solution to this problem.
sed 's!\o primary*!g primary!' /Users/username/Desktop/convert/Props00/Object.obj | sed 's!\o secondary*!g secondary!' > /Users/username/Desktop/convert/Props00/Object2.obj
rm -rf /Users/username/Desktop/convert/Props00/Object.obj
If anything is unclear, please let me know. Thank you!
Try this...
find /Users/username/Desktop/convert/ -name "Object.obj" -type f -exec sh -c '\
sed "s!\o primary*!g primary!" {} | sed "s!\o secondary*!g secondary!" > `dirname {}`/Object2.obj; \
rm -rf {} \
' \;
1 Like
Getting an error:
find: -exec: no terminating ";" or "+"
sorry n updated...
try it...
Hmm close, but still seems to have errors:
sed: rm: No such file or directory
sed: -rf: No such file or directory
^These two errors are repeated for every Object.obj that is supposed to be removed
coz, sed and rm commands are not separated using ';' and sed is thinking rm and -rf to be the input files and searching for them in current directory...
@bluesolo, you have mentioned
directories under convert..
Provide us the possible directories list ..
The problem is solved already, but thank you for replying.