I am self-learning regex so that I can manage my Linux files a lot better for work but I am having trouble finding a word that ends with a specified letter.

I know how to find words that begin with a letter using:

grep -o '\bs\w*' File.txt

I've been trying to add $ so it can do what I am looking for, though I have had no success.


  • 3
    If you want to manage files you probably need to put REs to one side for a short while and first learn about shell globs. These are far easier for most use cases and are (mostly) what the shells use for their pattern matching. Feb 12, 2017 at 21:10
  • Sure, thanks for the pointer, I will look into shell globs.
    – C. Medina
    Feb 12, 2017 at 21:22

1 Answer 1


Figured it out using:

grep -o '\w*s\b' File.txt

If anyone has a similar/better method with the same result please enlighten me.

  • \w and \b are GNU extensions. Feb 13, 2017 at 7:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .