I want to find a regex which contains the word Sat followed by one or more commas. I used this:
sed -e 's/Sat,+/Sat/ig' myfile.txt > output.txt
But it has no effect despite the fact that the file contains Sat,. Can you correct me?
I want to find a regex which contains the word Sat followed by one or more commas. I used this:
sed -e 's/Sat,+/Sat/ig' myfile.txt > output.txt
But it has no effect despite the fact that the file contains Sat,. Can you correct me?
The + is an extended regular expression symbol, while sed by default uses basic regular expressions.
In a basic regular expression, you may instead use \{1,\} or \+ (only GNU sed seems to know about \+ and it's not standard).
You may also switch sed to use extended expressions by using the -E option.
Related: