I'm working on a python fabric script that eases my solution deployment on different environments.
It works great so far, but I have at the end of the script a prompt that ask me if I want to edit a .yml config file, basically, to update my assets version. I go manually through vim inside and basically increment that number:
reconnection_delay: 50
max_attempts: 500
assets_version: 5360
How could I possibly automatically do that only with command line. Should use sed or perl it seems, but I'm not familiar with that, and some help might be appreciated here!
Thanks
perl -i.backup -pe 's{ ( \b assets_version: \s+ ) (\d+) $ }{ $1 . ( 1 + $2 ) }xmse;' your.yml
This will make a copy of your.yml named your.yml.backup, look for the line containing "assets_version:" and increment the number by 1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With