0
echo $HOME $var
/home/user abc

My variables.

echo $HOME$var | sed "s/$(echo $HOME$var | cut -c 3)/ello/g"
/hellome/userabc

This works as expected.

echo $HOME$var | sed "s/$(echo $HOME$var | cut -c 3-)/ello/g"
sed: -e expression #1, char 16: unknown option to `s'

Adding the range "3 to the end" produces failure. The subexpression has no problem when isolated.

  • 1
    What are you trying to do? – Valentin Bajrami Oct 23 '17 at 13:07
  • Replace text so it says "hello". – Lumify Oct 23 '17 at 13:10
  • 3
    change delimiter from / to any character that doesn't occur in your input.. for ex: # or , or | etc – Sundeep Oct 23 '17 at 13:17