I have the following occurrence:
DirUpload=/var/log
find $DirUpload | sed 's/$DirUpload//g'
The question is, how to use variable along with sed?
I have the following occurrence:
DirUpload=/var/log
find $DirUpload | sed 's/$DirUpload//g'
The question is, how to use variable along with sed?
According to the response from SOen : / p>
DirUpload=/var/log
find $DirUpload | sed "s|$DirUpload\/||g"
/
(in the example: |
) Just use double quotes rather than simple quotes:
DirUpload=/var/log
find $DirUpload | sed "s/$DirUpload//g"