How to use 'ls' command to list files like .dat, not *..dat
ls | egrep '^[^\.]+\.dat'
Do I get a prize?
Seriously, I don't think either ls
or any of the standard Linux shells will do what you want without doing something like the above. But I've been wrong before.
Andrew
1 Like
That's exactly what I was looking for...
In bash try:
GLOBIGNORE=*.*.dat
ls *.dat
3 Likes
In (recent!) bash
, try also
shopt -s extglob
ls !(*.*).dat
3 Likes
I stand corrected!
Andrew