Re: Great SWT Program
- From: blmblm@xxxxxxxxxxxxx <blmblm@xxxxxxxxxxxxx>
- Date: 16 Nov 2007 11:20:42 GMT
In article <a4448347-5043-4a7b-9dcd-3c9d8437012f@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
<twerpinator@xxxxxxxxx> wrote:
On Nov 14, 12:46 pm, blm...@xxxxxxxxxxxxx <blm...@xxxxxxxxxxxxx>
wrote:
I've written myself a little shell script that makes it easy to
start up vim on only the files that contain specified text
That has one obvious problem: you can't launch multiple interactive
apps simultaneously in the same terminal.
Actually maybe you can, with appropriate use of the "screen" utility.
But that's one I have yet to master.
Another place where using a
non-GUI system runs you smack into a severe disadvantage. Unless you
"cheat" and use an xterm while somehow making the script spawn a new
xterm instance for each copy of vi it launches. Without some such
trickery, you'll just get a single vi session open to the first file.
Then when you exit vi will promptly relaunch on the second file, and
so on, as the script blocks until each interactive process it launches
is terminated, then continues. That might be good enough for you,
depending, but if you wanted to flip between several of the files to
compare stuff or whatever you'll have a problem. :)
I sure would, if vi(m) were incapable of editing more than one file.
Fortunately, that's not the case. (I seem to remember that even
"real" vi had this capability, but I might be misremembering.)
If vi supports multiple documents, and launching with multiple files
specified on the command line, you might manage to get a single vi
with all of the files open in it at once IF the paths to all those
files don't collectively exceed the command line length limit for the
shell, whatever THAT is. For a large number of files you'd probably
hit some such limit and either get nothing or a vi session with only
some of the files open.
I don't remember this ever happening. If the collective length of
the file names exceeds the shell's limit, odds are I'm going to
considering some other way of working with the files anyway.
Of course you'd then be stuck with primitive,
awkward, and annoying pre-GUI methods of switching among open
documents...
Yeah. ":n<enter>" to go to the next file.
(I've had occasion to mass-select 80-odd text files and double click
one of them, producing 80 shiny new Notepad windows, and check for a
particular thing in each one before closing it. Easy as pie, and fast
too. Probably a script could be written to do something like that and
just output a list of files that didn't have the trait in question,
but writing and testing and running it would have taken much longer
than just doing what I did. If it had been 80,000 files, though, I'd
obviously have been cracking open the MS-DOS manual and writing a .bat
file. :)
Uh-huh. I'd have to know more about how you did the mass selection
(all the files in a folder, or did they have some common trait
that made it easy to select en masse) and about what you mean by
"didn't have the trait in question" to propose a Unix-y solution.
But unless there's something automation-resistant about which
files are to be selected, I'm pretty sure I could come up with
something no more complicated than what you just mentioned,
and without consulting any reference materials.
There'd still have been the issue of what to do with the
output if it was large enough. Change the script to move or copy the
"interesting" files to some working directory instead of merely
listing them, then go there and work with them after rerunning the
script, I suppose.)
A Unix-y approach would be to use the output of the script (if
it's a list of files) as input/argument to another program.
--
B. L. Massingill
ObDisclaimer: I don't speak for my employers; they return the favor.
.
- Follow-Ups:
- Re: Great SWT Program
- From: twerpinator
- Re: Great SWT Program
- References:
- Re: Great SWT Program
- From: Tristram Rolph
- Re: Great SWT Program
- From: blmblm
- Re: Great SWT Program
- From: twerpinator
- Re: Great SWT Program
- Prev by Date: Re: Great SWT Program
- Next by Date: Re: Great SWT Program
- Previous by thread: Re: Great SWT Program
- Next by thread: Re: Great SWT Program
- Index(es):
Relevant Pages
|
Loading