Try
/usr/bin/find . -depth -type f -print | /usr/bin/xargs -i /usr/bin/fgrep string '{}'
and run it several times so that the filesystem cache is primed.
Try
/usr/bin/find . -depth -type f -print | /usr/bin/xargs -i /usr/bin/fgrep string '{}'
and run it several times so that the filesystem cache is primed.
That's BS. The fgrep on my system – GNU grep 3.1 – provides recursive search (-r). What now, are you claiming that's not "real fgrep"? [1]
> that would be implementing tools within tools, which is against the UNIX®️ philosophy
Even more BS. Or are you telling me that "rm -r" is also against the "UNIX philosophy"?
> /usr/bin/find . -depth -type f -print | /usr/bin/xargs -i /usr/bin/fgrep string '{}'
Terrible, terrible advice. Cumbersome, error-prone, and slow as molasses. A quick test: Searching for 'asdfadsgf' in the Linux kernel repository takes 0.25 s using rg, 12 s using GNU fgrep -f, and 228 s (!) using your command.
You know, when your ideology results in the worst results of all, you should really reconsider your ideology.
GNU stands for GNU is not UNIX®️.
Edit: this highlights the big weakness in the "UNIX philosophy", in which the only record delimiter that's conventionally recognized in pipelines is the newline but the shell recognizes characters as filename delimiters that are also allowed in filenames. Causing a cascade of delimiter bugs. Sometimes you really do need a bit more structure to your data.
(The UNIX philosophy is best understood in contrast to what went before - the COBOL or JCL style where files had fixed records, in turn based on fixed-column punchcard layouts.)
[0] https://mywiki.wooledge.org/BashPitfalls#for_f_in_.24.28ls_....
foo | sort
with foo > file
sort < file
I like the idea of powershell, but every time I try to do something complicated with it I'm disappointed. $WhateverObject | Export-CliXml
$WhateverObject = Import-CliXml whatever.xml
Most of the time `>` also work.By the way, PowerShell serialization is by orders of magnitude better then anything *nix has to offer as you can use objects from other machine shell just like they exist on your local one.
> I like the idea of powershell, but every time I try to do something complicated with it I'm disappointed.
I did some very complicated things in PowerShell. For example, check out the script that maintains ~300 mainstream packages on Chocolatey up to date, all in few minutes with bunch of self maintenance features.
You need to learn it, simple as that.
https://gist.github.com/choco-bot/a14b1e5bfaf70839b338eb1ab7...
Yeah, spaces are nasty. find has -print0 and xargs has -0 to handle this gracefully, but one needs to know to use it.