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
  • 809
  • 7
  • 18

2 Answers2

2

Using awk:

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

Using cut:

cut -d '(' -f 1 file

Using sed:

sed 's/(.*//' file
Kusalananda
  • 14,885
  • 3
  • 41
  • 52
1

Following awk may help you on same.

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

With sed:

sed 's/(.*//'   Input_file
RavinderSingh13
  • 130,504
  • 14
  • 57
  • 93