Link to home
Create AccountLog in
Avatar of areyouready344
areyouready344Flag for United States of America

asked on

list words with hypens using sed or awk utilities "linux

I need your help once again to list words in files with only hypens using either sed or awk linux utilities on each line in files...

for example,

Please return the books to the library before risk-inducing charges take place.

Output,

risk-inducing

SOLUTION
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Tintin
Tintin

grep is easiest

grep -oE '\w+-\w+' file

Open in new window

Avatar of areyouready344

ASKER

I forgot to mention, I don't need numbers in hypens, only letters

for example,

2349-okay, 34340434-9090,  risk-inducing,

Output,

risk-inducing
ASKER CERTIFIED SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
thanks Tintin, your answers worked out great
good answers