1
0
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
1
0
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
4
grep "[;.]$" list-of-files
This matches any line which contains either ;
or .
followed by the end of the line.
.. how does this work ? – ricedragon – 2011-10-04T03:08:55.540
@ricedragon it's regex notation. [abc] means a or b or c. $ means match end of line. play with regex coach and see http://www.regular-expressions.info/ and grep -P is a bit more flexible.
– barlop – 2011-10-04T04:04:25.860
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 – 2011-10-04T07:52:38.513