This is my first time attempting to use SED.
I can get the substitution command to work with simple strings. As in:
sed -i 's/foo/bar/g' file.txt
However when I attempt to use a Regex it stops working. The regex I want to use is trying to identify URLs:
(https?:)?(\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)
I am trying to remove all URLs from a text file. Here's my full command:
sed -i 's/(https?:)?(\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)//g' file.txt
Can anyone see the issue?