How to omit a part of the string

I have a file, f1 with content:

File f1:

abc_English_Dlr
def_123_English_Dlr
qwe_98_yu_English_Dlr
dsw_1_English_Dlr
 

I want to remove "_English_Dlr" from it.

I used cut command but the problem is there may be a case for getting 1 or more fields before _English_Dlr . So Cut command is useless.

Can oneone help me this using SED ??

Thanks!

vi YOUR_FILE
:%s/_English_Dlr//
:wq
$ cat f
abc_English_Dlr
def_123_English_Dlr
qwe_98_yu_English_Dlr
dsw_1_English_Dlr
$  sed 's/_English_Dlr//' f
abc
def_123
qwe_98_yu
dsw_1

Guru.

$ sed 's,_English_Dlr,,g' infile
$
$ nawk '{sub(/_English_Dlr/,"")};1' infile
$
$ nawk -F"_English_Dlr" '{print $1}' test
abc
def_123
qwe_98_yu
dsw_1
perl -lpe '$_=reverse' INPUTFILE | cut -d '_' -f3- | perl -lpe '$_=reverse'

:wink:

$ perl -lane '@a=split(/_English_Dlr/);print $a[0]' test    
abc
def_123
qwe_98_yu
dsw_1

---------- Post updated at 04:32 PM ---------- Previous update was at 04:19 PM ----------

One more in perl

 
$ perl -lne '$_=~s/_English_Dlr.*//;print ' test                                                                                                   
abc
def_123
qwe_98_yu
dsw_1

@ All

Thanks for the quick replies.... Its worked.

Thank you!

Can you share any link where can I get whole about SED. :wink:

Sed - An Introduction and Tutorial