I need to find file from ls - l by using grep and certain regexp.
In particular I need greep to see certain file ending, like let's say .txt but only using regex.
So it should be something like
ls -l | grep '^.+\.txt$'
But that doesn't seem to work for me.
ls -l *.txt? Also note that with the eoln match ($), this will not pick up symlinks. With extended regexp (as Matt mentions), you might want to use '^.+\.txt\>' $ ls -l *.txt lrwxrwxrwx 1 arcege arcege 8 2011-04-07 09:04 file.txt -> realfile $ ls -l | grep -E '^.+\.txt$' $ ls -l | grep -E '^.+\.txt\>' lrwxrwxrwx 1 arcege arcege 8 2011-04-07 09:04 file.txt -> realfile – Arcege Apr 7 '11 at 13:06