Substitution



About

Search, find and replace from the command line

Snippets


Version Bump
find . -type f -exec sed -i 's/1\.0\.2/1\.0\.3/g' {} \;
Variable Substring Substitution
CARLA_TARBALL=/mnt/mervin/workspaces/devel/carla/carla_tri_tools/../carla/Dist/CARLA_0.9.9.4.tar.gz
# Extract the version using sed
CARLA_VERSION=`echo ${CARLA_TARBALL} | sed 's/.tar.gz//' | sed 's/.*CARLA_//'`
# Alternatively, using bash parameter substitution
CARLA_VERSION=${CARLA_TARBALL/.tar.gz/}
CARLA_VERSION=${CARLA_VERSION/*CARLA_/}