linux - Select files by extenstion using grep -
i need count .txt files in current folder. tried ls | grep .txt if folder content is: a.txt btxt c.c select a.txt , btxt , want files end .txt. tried various combinations of regexp no result.
find may better in case since designed handling file names:
find . -maxdepth 0 -name '*.txt' | wc -l buf if cautious possibly strange file names:
find . -maxdepth 0 -name '*.txt' -exec echo 1 \; | wc -l
Comments
Post a Comment