Stripping ret of the lines in a file (sed question)

Hi all,

I didn't use SED for 20 years and was never an expert. So my current knowledge is about zero. Please be patient with me. I'm neither a native speaker.

I have a huge dictionary file and want the rest of the lines stripped. Everything after (and including) the "/" should be stripped. I just want to obtain the "pure" words.

example (see attached file):

emanate/XSDVNG
emanation/M
emancipate/DSXGN
emancipation/M
emancipator/MS
Emanuele/M
Emanuel/M
emasculate/GNDSX
emasculation/M
embalmer/M
embalm/ZGRDS
embank/GLDS
embankment/MS
embarcadero
embargoes
embargo/GMD
embark/ADESG
embarkation/EMS

Please note, that not every line has a "/" in it. For example "embarcadero" has not. No action should be taken then.

Can someone give me the best command to do the job? Your help is very much appreciated.

Try:

sed 's|/.*||' example.txt
1 Like

Thanks!