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?

sungjun cho
  • 705
  • 3
  • 14

2 Answers2

2

Using awk:

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

Using cut:

cut -d '(' -f 1 file

Using sed:

sed 's/(.*//' file
Kusalananda
  • 13,751
  • 3
  • 35
  • 49
1

Following awk may help you on same.

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

With sed:

sed 's/(.*//'   Input_file
RavinderSingh13
  • 117,272
  • 11
  • 49
  • 86