Reputation: 623
I'm currently using the 'sed' command (below) which searches for the word {{Title}} and replaces it with the current working directory ${PWD##*/}/.
sed -i "s/{{Title}}/${PWD##*/}/g" filename.x
How do I modify the above 'sed' command to work for the full path of the current working directory?
Any help will be much appreciated!
Upvotes: 1
Views: 76
Reputation: 8617
Change the s
command to use a separator that is not part of the path. Generally, :
is not allowed in path names so it's safe to use here instead of /
, like instead of:
s/expression/$PWD/
use
s:expression:$PWD:
Upvotes: 1