DEV Community

Discussion on: Automating Simple Things with Python is Awesome

Collapse
 
rpalo profile image
Ryan Palo

Neat! Thanks for sharing πŸ˜„ you could also do it in pure Bash with a for loop and string indexing. But it’s not as nifty as your way.

Collapse
 
rrampage profile image
Raunak Ramakrishnan • Edited

Yes. Another way I found was using awk instead of source as follows:

find . -type f -name "*.1" | sed -nr "s/(^.*)\.(.*)\.1/mv \1.\2.1 \1.\2/p" | awk '{system($0)}'

This makes the eval of strings part of the pipeline.