Need sed script to remove characters

Hi,
I need a sed script that will remove everything after and including the open paranthesis character "(".

For example, if I have a string like this:
Inventory_Listing(Br-01)

I need it to be:
Inventory_Listing

Any help would be appreciated.
9thTeeAsked:
Who is Participating?
 
sweetfa2Commented:
sed 's/\(.*\)(.*/\1/' filename
0
 
farzanjCommented:
sed "s/(.*//" filename

If you want to change the file at the same time, try using option -i
0
 
Kamaraj SubramanianApplication Support AnalystCommented:
$ sed 's/\(.*\)(.*/\1/' test1
Inventory_Listing

#some other ways

$ nawk -F\( '{print $1}' inputfile
Inventory_Listing
$ cut -d"(" -f1 inputfile
Inventory_Listing

Open in new window

0
 
Kamaraj SubramanianApplication Support AnalystCommented:
$ echo "Inventory_Listing(Br-01)" |perl -lane '$_=~s/\(.*//; print $_'                                                            
Inventory_Listing

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.