Reputation: 125
I am trying to use sed to remove these double backslashes in the front of this string so that this:
//s3.amazonaws.com/umdheader.umd.edu/app/js/main.min.js
will become:
s3.amazonaws.com/umdheader.umd.edu/app/js/main.min.js
so far I have it where it can remove one through the com
sed 's/^\///g' output
but i need to remove two! please let me know thanks :)
Upvotes: 2
Views: 1508
Reputation: 15461
You can choose another delimiter than /
in your command:
sed 's;^//;;' file
Or, if you want to escape the /
:
sed 's/^\/\///' file
Upvotes: 1
Reputation: 133428
Or in case you don't want to escape /
and simple want to substitute /
starting ones with NULL then do following.
echo "//s3.amazonaws.com/umdheader.umd.edu/app/js/main.min.js" | sed 's#^//##'
Upvotes: 2
Reputation: 66
You can try it this way with sed:
echo "//s3.amazonaws.com/umdheader.umd.edu/app/js/main.min.js" | sed 's/^.*amazon/amazon/g'
or by regular expressions of variables
$ variable="//s3.amazonaws.com/umdheader.umd.edu/app/js/main.min.js"
$ echo ${variable#*//}
$ s3.amazonaws.com/umdheader.umd.edu/app/js/main.min.js
Upvotes: 2