0

For example,

if there is:

hello(abcdef) = 3
good(adss) = 5

then I have to replace these into:

hello
good

Thus I need to delete each line from '(' to right '\n' and replate these into '\n'

Is is possible by using sed or awk?

1
  • 1
    Please always show your efforts in your posts too. Commented May 12, 2018 at 7:50

2 Answers 2

2

Using awk:

awk -F '(' '{ print $1 }' file

Using cut:

cut -d '(' -f 1 file

Using sed:

sed 's/(.*//' file
1

Following awk may help you on same.

awk '{sub(/\(.*/,"")} 1'   Input_file

With sed:

sed 's/(.*//'   Input_file

Not the answer you're looking for? Browse other questions tagged or ask your own question.