linux regular expression
file name: lab3test.txt
Create regular expressions that meet the following criteria. You may use grep or egrep to answer these questions.
1.Write a SED command that could replace all of the area codes that use parenthesis so that they are removed and replaced with a single dash like the others. Example: (222) 222-2222 should become 222-222-2222.
SED command that could replace all of the area codes that use parenthesis so that they are removed and replaced with a single dash like the other is:
Command:
sed -E 's/\(([^()]*)\)/\1/' lab3test.txt
This works as intended and replaces the parenthesis '()' with a '-' dash.
I executed this in Linux UBUNTU and it works perfectly fine. Here is the output.
If you have any doubts, leave a comment below before rating. I'll be happy to assist you further.
Do UPVOTE this as I have put a lot of EFFORT in answering this question. It really helps me.
Get Answers For Free
Most questions answered within 1 hours.