sed removing until end of line

All:

Can somebody help me out with a sed command, which removes the the first occurance of ')' until the end of the line

If I have the following input

 
xxx))(COMMAND=status)(ARGUMENTS=64)(PASSWORD=xxxxxxxx)(SERVICE=(ADDRESS=(PROTOCOL=TCP)(HOST=fpeast.odc.vzwcorp.com)(PORT=1521)))(VERSION=153093632))

oracle)))
 

I would expect to see

xxx
oracle

Thanks in advance to all who answer

Hi,

Try:

$ sed 's/^\([^)]*\).*/\1/' infile

Regards,
Birei

sed -n 's/\([^)]\)).*/\1/p' file

or:

awk -F")" 'NF{print $1}' file

awk?

awk '  (p=index($0,")")) {print substr($0,1, p -1 );next} 1'  filename

Guys,

Thanks!! Franklin your sed works great and even removes blank lines.

If you have a moment can you breifly describe to me what this is doing?

's/\([^)]\)).*/\1/p'

Or:

sed 's/).*//' infile

or

cut -d\) -f1 infile

or

sed -n 's/).*//p' infile

if your want to remove empty lines too