I have a file that contains lines of the type -
find /home/subd1/subd2/$dirname -type d
find /home1/subd1/subd2/$dirname -type d
find /home10/subd1/subd2/$dirname -type d
I want to find /home/ or /home<no>/ and replace it with DIFFERENT /home/ or /home<no>/. Basically, find and replace -
/home with /home2 or
/home2 with /home3 or
/home3 with /home
etc.
I tried doing -
sed -i 's/\/home.?\//\/home3\//g' /path/to/file
sed -i 's/\/home[\d]?\//\/home3\//g' /path/to/file
But this made no change to the file. Am i missing something here? Thanks