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

Re: Using terminal output as input



On Tue,19.May.09, 11:13:34, Eric Gerlach wrote:
 
> 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

Building a bit on Eric's ideea:

$ first_command | pipedit second_command

where 'pipedit' is a small shell script (pseudocode):

stdin > /tmp/tempfile
$EDITOR /tmp/tempfile
$@ < /tmp/tempfile
rm /tmp/tempfile

The only trouble with this is that some commands need a '-' parameter to 
read from stdin. It might be possible to solve it by greping for 
specific keywords in the '--help' output of second_command.

Regards,
Andrei
-- 
If you can't explain it simply, you don't understand it well enough.
(Albert Einstein)

Attachment: signature.asc
Description: Digital signature


Reply to: