0

Let's say I have a file with many URLs:

http://foo.com/abc_(Programming_Language)
http://example.com/test)

I'd like to remove the trailing ) for each line in which there is no opening ( using sed and/or grep.

The result file should look like this:

http://foo.com/abc_(Programming_Language)
http://example.com/test

How can I do this?

2 Answers 2

1

I think this will do:

sed '/(.*)/! s/)$//' file 
0

I have done by below awk command

command

awk '$0 !~ /\(/{gsub(")","",$0);}1' filename

output

http://foo.com/abc_(Programming_Language)
http://example.com/test

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.