jbanana: Badly drawn banana (Default)
[personal profile] jbanana
The command prompt in Unix/Linux has always let you do fancy stuff. For example, here's one way to edit all the Java code that contains "someSearchString":
find . -name "*.java" -exec grep -q "someSearchString" '{}' \; -exec someEditor '{}' \;
On Windows, the command prompt is less rubbish than used to be. Here's one way to do the same task:
for /f "tokens=*" %G in ('dir /s /b *.java') do @(find "someSearchString" >nul && someEditor %G)
I like the way that both examples use find but it means something completely different.

Edit: one obvious difference: the *nix version ill search for a regex, but Windows will only do plain text
Bnother edit: simplified the Windows version by redirecting to NUL.

June 2017

M T W T F S S
    1234
567891011
1213141516 1718
19202122232425
2627282930  

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 22nd, 2017 02:12 pm
Powered by Dreamwidth Studios