Answer by Stéphane Chazelas for Count number of files that are not symbolic...
With zsh:set -o extendedglob # best in ~/.zshrcc_regular_files=( ${(0)^"$(locate -0 "${${PWD%/}//(#m)[]\\*?]/\\$MATCH}/*.c")"}(N.))echo there are at least $#c_regular_files regular files whose name...
View ArticleAnswer by Ole Tange for Count number of files that are not symbolic links in...
With GNU Parallel it looks like this:locate -r "$PWD.*\.c$" | parallel 'test -f {} && echo "regular file"' | wc -lAs you can see it is extremely close to your initial attempt.If you have fewer...
View ArticleAnswer by Kusalananda for Count number of files that are not symbolic links...
Rather than parsing the output of locate (which is fragile and may miss things that have changed since its database was last updated, or that are not available to all users), use find.The following...
View ArticleAnswer by muru for Count number of files that are not symbolic links in...
This command came close:locate -r "$PWD.*\.c$" | xargs -0 -I{} test -f {} && echo "regular file" | wc -lProblems:You're using nul delimited input with xargs, but locate isn't providing nul...
View ArticleCount number of files that are not symbolic links in output from "locate"
I'm trying to count the number of non-symbolic linked files passed by the locate command. I've tried a number of options and think this is the most promising:locate -r "$PWD.*\.c$" | xargs -0 -I{} test...
View Article