[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Using terminal output as input



On Tue, May 19, 2009 at 8:43 PM, Eric Gerlach
<egerlach@feds.uwaterloo.ca> wrote:
> On Tue, May 19, 2009 at 01:31:30PM +0300, Dotan Cohen wrote:
>> > I also suggested the copying/pasting approach via gnu/screen's mechanism
>> > but that's not really what the OP was asking and maybe there should be a
>> > smarter alternative..??
>> >
>>
>> Actually, it seems that copy-paste is in fact what I am looking for. I
>> just figured that this would be common enough to be a part of the
>> shell itself, not something that would require workarounds or hacks. I
>> intend to learn screen.
>
> If you're looking to take the output from a command, edit it, then pipe it back
> into another command, may I suggest your favourite editor?
>
> vim can do it like so (for example):
>
> (in command mode)
> !!ls
> (edit to your heart's content)
> :%!wc
>
> I'm sure emacs can do it too, but I don't know emacs all that well.
>
> Cheers,

I tried this:

$ which firefox | vim -

vim opened.

Now when I press !!

:.!

appears at bottom.

Next I type |s and I get this error:

/bin/bash: -c: line 0: syntax error near unexpected token `|'
/bin/bash: -c: line 0: `(|s) < /tmp/v754567/14 >/tmp/v754567/15 2>&1'

shell returned 2


Reply to: