3 ms·
grep -rl 500 . wasn't accepted. Am I wrong or is it wrong?
by coherentpony 10y ago
grep -rl 500 .
wasn't accepted. Am I wrong or is it wrong?
- leblancfg 10y agoYou are: grep matches strings, not integers. grep -rl '500' works just fine.
- tne 10y agoThere is no concept of an integer on an argument vector. Quoting in bash just escapes IFS characters (usually whitespace) to control whether to include them in a given argument on the vector, but these arguments (as passed to exec) are always character strings (with or without quoting).
- godelski 10y agoInterestingly enough grep -rl "500" . doesn't work because it returns with the "./".
- snuxoll 10y agoOnly filenames matching access.log should be returned. Unfortunately, since shopt globstar is disabled I ended up needing to do this: grep 500 $(find . -type f -iname "access.log*")
- JoshTriplett 10y agoYou could also include "shopt -s globstar; " at the beginning of your line.
- joshka 10y agogrep -r 500 --include access.log
- slavik81 10y agoThat returns the filenames in the format "./access.log" but it wanted "access.log". It's a bug. I used echo -e 'access.log\naccess.log.1\nREADME'. :D
- Galanwe 10y agoHahahaha I did the exact same thing
- coherentpony 10y agoGotcha. Thanks.