View Single Post
  #23  
Old June 9th 17, 03:27 PM posted to alt.comp.os.windows-10
Mayayana
external usenet poster
 
Posts: 6,438
Default Adding one line to a directory full of text files

"Jonathan N. Little" wrote

| You could do this simply with a one-liner in bash on Linux ;-)
|
| for f in $(grep -L "do this" *.xxx); do echo "do this" $f; done
|

I'm not a bash user, but I don't see
where you checked for trailing carriage
returns or added the line where it's missing.
It looks to me like your code will merely
list all files that contain "do this", which
has nothing to do with the request. (If
I'm mistaken then perhaps you could explain.)

That's the problem with command line.
It's limited. Well, that's the second problem.
The first is that it's tedious. The VBScript
(or software) takes more work to write, but
it can be reused and it's functionality is
endlessly adaptable. I keep dozens of VBScripts
on my desktop and use them daily. One fixes
line returns in files from *Nixers. One converts
DOCs to text. One cleans up obfuscated URLs.
One cleans out all my TEMP folders. And so on.
I wrote them once and don't have to ever do
it again.

Then of course there's the problem that
ugly Linux command lines can't edit files on
a Windows computer. And of course there's
the problem that life is just too short for
regular expressions. But your code certainly
does look clever. I'll grant you that.


Ads