Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to write a command to display all the lines in a given file that end with a ";" or a "." character.

Why does this not work?

grep ".';' | .'\.'" filename
share|improve this question
I fixed your titles so they were actually meaning something. It would be great – if you post a question – to make your title really specific about what you want to do, not "Unix grep". – slhck Oct 4 '11 at 7:52
up vote 4 down vote accepted
grep "[;.]$" list-of-files

This matches any line which contains either ; or . followed by the end of the line.

share|improve this answer
.. how does this work ? – ricedragon Oct 4 '11 at 3:08
@ricedragon it's regex notation. [abc] means a or b or c. $ means match end of line. play with regex coach and see and grep -P is a bit more flexible. – barlop Oct 4 '11 at 4:04

You must log in to answer this question.

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