According to your comment the “haystack” of your search is a set of gzipped text files (based on the file name extension .gz
). You can scan them with the zgrep
command, a wrapper around the grep
command that decompresses gzipped files on the fly and supports most of the same options as grep
itself.
Thus you can simply run
zgrep -oHe 7505857289 <FILES>...
which will print the name of the source file followed by a colon and the matching character sequence for each match.
If you need a specific output format I recommend that you transform it. For matching text followed by a space and the source file name that would be:
zgrep ... | sed -re 's/^([^:]*):(.*)$/\2 \1/'
grep -rH '7505857289' <directory_name>
.-r
is for recursive search down directory tree, and-H
to include filename. If you run intoArgument list too long
error, usefind -type f -exec grep -H '7505857289' {} \;
file
it just means regular file. The information you posted in the comment just now should be inside the question itself, so please edit that so that others can see it.