Quantcast
Channel: Count number of files that are not symbolic links in output from "locate" - Unix & Linux Stack Exchange
Browsing all 5 articles
Browse latest View live

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 Article



Answer 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 Article

Answer 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 Article

Answer 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 Article

Count 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

Browsing all 5 articles
Browse latest View live




Latest Images