Re: Using terminal output as input

2009-05-26 Thread Barclay, Daniel
Chris Bannister wrote: ... > > apt-cache show gpm > Description: General Purpose Mouse interface > [..] > By default, the daemon provides a 'selection' mode, so that > cut-and-paste with the mouse works on the console just as it does > under X. Speaking of gpm _and_ X: Can gpm be connected X'

Re: Using terminal output as input

2009-05-23 Thread Chris Jones
On Sat, May 23, 2009 at 05:05:25AM EDT, Chris Bannister wrote: > On Tue, May 19, 2009 at 01:31:30PM +0300, Dotan Cohen wrote: > > Actually, it seems that copy-paste is in fact what I am looking for. > > As has been mentioned already! "apt-get install gpm" works a treat, in > fact, would classify

Re: Using terminal output as input

2009-05-23 Thread Osamu Aoki
On Sat, May 23, 2009 at 09:05:25PM +1200, Chris Bannister wrote: > On Tue, May 19, 2009 at 01:31:30PM +0300, Dotan Cohen wrote: > > Actually, it seems that copy-paste is in fact what I am looking for. I > > As has been mentioned already! "apt-get install gpm" > works a treat, in fact, would classi

Re: Using terminal output as input

2009-05-23 Thread Chris Bannister
On Tue, May 19, 2009 at 01:31:30PM +0300, Dotan Cohen wrote: > Actually, it seems that copy-paste is in fact what I am looking for. I As has been mentioned already! "apt-get install gpm" works a treat, in fact, would classify it as an essential cli tool. apt-cache show gpm Description: General Pu

Re: Using terminal output as input

2009-05-21 Thread Boyd Stephen Smith Jr.
In <880dece00905210835w451e87e1t4307a8727d654...@mail.gmail.com>, Dotan Cohen wrote: >I would assume that handling user input / >output is the role of the terminal (not the shell), and therefore >copy/paste falls into it's role. Oh, yes. I agree. Physical terminals (even the Linux VCs) are gene

Re: Using terminal output as input

2009-05-21 Thread Dotan Cohen
>>just figured that this would be common enough to be a part of the >>shell itself, > > Probably mostly for historical reasons, the shell doesn't handle terminal > manipulations.  In particular, the shell doesn't know that the input you > want is 5 rows up and 12 columns over or have any (special)

Re: Using terminal output as input

2009-05-20 Thread Tzafrir Cohen
On Tue, May 19, 2009 at 10:02:54AM -0500, Boyd Stephen Smith Jr. wrote: > AIUI, screen is quite scriptable and should be capable of sending output to > the process(es) attached to it. This would allow you to write "screen > scripts" that used the shell for what it is good at and used screen for

Re: Using terminal output as input

2009-05-19 Thread Andrei Popescu
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

Re: Using terminal output as input

2009-05-19 Thread Chris Jones
On Tue, May 19, 2009 at 10:24:39AM EDT, Barclay, Daniel wrote: > Chris Jones wrote: > > On Mon, May 18, 2009 at 04:13:16PM EDT, Barclay, Daniel wrote: > >> Dotan Cohen wrote: > > > ... > > > >> Are you asking about manually selecting part of the output of a > >> command(s) and using it to assembl

Re: Using terminal output as input

2009-05-19 Thread Eric Gerlach
On Tue, May 19, 2009 at 09:42:36PM +0530, Foss User wrote: > On Tue, May 19, 2009 at 8:43 PM, Eric Gerlach > wrote: > > 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

Re: Using terminal output as input

2009-05-19 Thread Boyd Stephen Smith Jr.
In <880dece00905190331s5afdc3d5y72900275bef8...@mail.gmail.com>, Dotan Cohen wrote: >> I also suggested the copying/pasting approach via gnu/screen's mechanism > >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 >shel

Re: Using terminal output as input

2009-05-19 Thread Foss User
On Tue, May 19, 2009 at 8:43 PM, Eric Gerlach 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..

Re: Using terminal output as input

2009-05-19 Thread Dotan Cohen
> 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 do

Re: Using terminal output as input

2009-05-19 Thread Eric Gerlach
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 w

Re: Using terminal output as input

2009-05-19 Thread Barclay, Daniel
Chris Jones wrote: > On Mon, May 18, 2009 at 04:13:16PM EDT, Barclay, Daniel wrote: >> Dotan Cohen wrote: > ... > >> Are you asking about manually selecting part of the output of a >> command(s) and using it to assemble another command (as opposed to >> piping the whole output from one command in

Re: Using terminal output as input

2009-05-19 Thread Dotan Cohen
> 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

Re: Using terminal output as input

2009-05-18 Thread Chris Jones
On Mon, May 18, 2009 at 04:13:16PM EDT, Barclay, Daniel wrote: > Dotan Cohen wrote: > >> If you told us exactly what you want to achieve, we might be able > >> to help you better. The OP did say exactly what he wants - that the output of one command should be made available to the user so that he

Re: Using terminal output as input

2009-05-18 Thread Barclay, Daniel
Dotan Cohen wrote: >> Like you said, it does require foreknowledge of the output. So there is >> no way to make a one-size-fits-all solution, be it a command-line trick >> or a program. >> >> If you told us exactly what you want to achieve, we might be able to >> help you better. >> > > I just wan

Re: Using terminal output as input

2009-05-17 Thread Boyd Stephen Smith Jr.
In <4a0ffa4a.5040...@kalinowski.com.br>, Eduardo M KALINOWSKI wrote: >(or `command`, though this is a bashism) Not a bash-ism. It is the older method and still required in SUS-conformant shells. However, it doesn't nest well and has other issues that are required not to affect $(). -- Boyd St

Re: Using terminal output as input

2009-05-17 Thread Boyd Stephen Smith Jr.
In <880dece00905170250o422275adv83039d8ece728...@mail.gmail.com>, Dotan Cohen wrote: >2009/5/14 Boyd Stephen Smith Jr. : >> These are particularly useful when combined with the "UNIX filter >> commands" tr, grep, sed, cut, paste, and awk plus the tee command. > >I am baffled that one must type in

Re: Using terminal output as input

2009-05-17 Thread Roger Leigh
On Sun, May 17, 2009 at 01:11:54PM +, Tzafrir Cohen wrote: > On Sun, May 17, 2009 at 08:51:38AM -0300, Eduardo M KALINOWSKI wrote: > > > As other people have pointed out, the way to capture a command's output > > is with $(command) (or `command`, though this is a bashism). > > $(command) is

Re: Using terminal output as input

2009-05-17 Thread John Hasler
Dotan Cohen writes: > Yes, it seems that what I am looking for is copy-paste. I have seen it > suggested that screen can do this, though I have not yet looked into it > in detail. The Linux console can do it with gpm. -- John Hasler -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.

Re: Using terminal output as input

2009-05-17 Thread Dotan Cohen
> As other people have pointed out, the way to capture a command's output > is with $(command) (or `command`, though this is a bashism). However, > unless the output is exactly in the form you need (which is often not > the case; in your example ifconfig outputs a lot of information besides > the I

Re: Using terminal output as input

2009-05-17 Thread Tzafrir Cohen
On Sun, May 17, 2009 at 08:51:38AM -0300, Eduardo M KALINOWSKI wrote: > As other people have pointed out, the way to capture a command's output > is with $(command) (or `command`, though this is a bashism). $(command) is bashism. `command` is the "pure" bourne shell form. $ posh $ echo `echo hi

Re: Using terminal output as input

2009-05-17 Thread Eduardo M KALINOWSKI
Dotan Cohen wrote: > I am baffled that one must type in the output to commands. For > instance, the sysadmin may need to use the existing DHCP IP address > for one reason or another. After running ifconfig, where the address > is stated, why must he type it in? I'm not looking for copy-paste in > t

Re: Using terminal output as input

2009-05-17 Thread Dotan Cohen
> For stuff like that where the output is totally unpredictable, I doubt > anything beats the flexibility of gnu/screen's copy/paste mechanism. > This seems to be the key that I was looking for! I will look into gnu/screen's copy/paste mechanism. Thanks. -- Dotan Cohen http://what-is-what.com h

Re: Using terminal output as input

2009-05-17 Thread Dotan Cohen
2009/5/14 Boyd Stephen Smith Jr. : > In <880dece00905140755w67aefd85uacffa635c306...@mail.gmail.com>, Dotan Cohen > wrote: >>I am using a Debian-based distro (Ubuntu). Often I need to use the >>output of one terminal command as the input for another. > > UNIX-ish OSes and programs are designed for

Re: Using terminal output as input

2009-05-17 Thread Chris Jones
On Thu, May 14, 2009 at 10:55:35AM EDT, Dotan Cohen wrote: > I am using a Debian-based distro (Ubuntu). Often I need to use the > output of one terminal command as the input for another. A classic > example is the which command: > $ which firefox > /usr/bin/firefox > $ > > Now, I would like to us

Re: Using terminal output as input

2009-05-17 Thread Dotan Cohen
> Like you said, it does require foreknowledge of the output. So there is > no way to make a one-size-fits-all solution, be it a command-line trick > or a program. > > If you told us exactly what you want to achieve, we might be able to > help you better. > I just want to know in a very general se

Re: Using terminal output as input

2009-05-15 Thread Tzafrir Cohen
On Thu, May 14, 2009 at 05:55:35PM +0300, Dotan Cohen wrote: > I am using a Debian-based distro (Ubuntu). Often I need to use the > output of one terminal command as the input for another. A classic > example is the which command: > $ which firefox > /usr/bin/firefox Use a terminal that supports

Re: Using terminal output as input

2009-05-15 Thread Frank Lin PIAT
On Thu, 2009-05-14 at 13:26 -0400, S Scharf wrote: > > On Thu, May 14, 2009 at 11:13 AM, Dotan Cohen > wrote: > > Not pretty but how about > > `ekiga | head -2 | tail -1` > > > > (note use of backticks) > > > > > That's creative! I

Re: Using terminal output as input

2009-05-15 Thread S Scharf
Another way of doing this is to run the command that generates the output in a shell that captures the output for editing. For example use 'screen' or the shell mode of 'emacs'. Stuart

Re: Using terminal output as input

2009-05-15 Thread PaulNM
On Thu, 2009-05-14 at 20:29 -0300, tyler wrote: > Dotan Cohen writes: > > > I am using a Debian-based distro (Ubuntu). Often I need to use the > > output of one terminal command as the input for another. A classic > > example is the which command: > > $ which firefox > > /usr/bin/firefox > > $

Re: Using terminal output as input

2009-05-14 Thread tyler
Dotan Cohen writes: > I am using a Debian-based distro (Ubuntu). Often I need to use the > output of one terminal command as the input for another. A classic > example is the which command: > $ which firefox > /usr/bin/firefox > $ This may be a stupid question, but what's the difference between

Re: Using terminal output as input

2009-05-14 Thread Boyd Stephen Smith Jr.
In <78582fa40905141033n6248df7fy35fb1727e260d...@mail.gmail.com>, S Scharf wrote: >$(ekiga 2>/dev/stdout | head -2 | tail -1) More portable, but the same results: $(ekiga 2>&1 | head -n 2 | tail -n 1) -- Boyd Stephen Smith Jr. ,= ,-_-. =. b...@iguanasuicide.net

Re: Using terminal output as input

2009-05-14 Thread S Scharf
On Thu, May 14, 2009 at 1:26 PM, S Scharf wrote: > > > On Thu, May 14, 2009 at 11:13 AM, Dotan Cohen wrote: > >> > Not pretty but how about >> > `ekiga | head -2 | tail -1` >> > >> > (note use of backticks) >> > >> >> That's creative! It doesn't seem to work on this system, I will try on >> Real

Re: Using terminal output as input

2009-05-14 Thread S Scharf
On Thu, May 14, 2009 at 11:13 AM, Dotan Cohen wrote: > > Not pretty but how about > > `ekiga | head -2 | tail -1` > > > > (note use of backticks) > > > > That's creative! It doesn't seem to work on this system, I will try on > Real Debian (tm) when I get home. However, it does require > foreknowl

Re: Using terminal output as input

2009-05-14 Thread Ken Irving
On Thu, May 14, 2009 at 05:55:35PM +0300, Dotan Cohen wrote: > I am using a Debian-based distro (Ubuntu). Often I need to use the > output of one terminal command as the input for another. A classic > example is the which command: > $ which firefox > /usr/bin/firefox > $ > > Now, I would like to

Re: Using terminal output as input

2009-05-14 Thread Boyd Stephen Smith Jr.
In <880dece00905140755w67aefd85uacffa635c306...@mail.gmail.com>, Dotan Cohen wrote: >I am using a Debian-based distro (Ubuntu). Often I need to use the >output of one terminal command as the input for another. UNIX-ish OSes and programs are designed for this, but you'll have to learn the small t

Re: Using terminal output as input

2009-05-14 Thread Eduardo M KALINOWSKI
Dotan Cohen wrote: >> Not pretty but how about >> `ekiga | head -2 | tail -1` >> >> (note use of backticks) >> >> > > That's creative! It doesn't seem to work on this system, I will try on > Real Debian (tm) when I get home. However, it does require > foreknowledge of the output, which I suppo

Re: Using terminal output as input

2009-05-14 Thread Harry Rickards
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/14/09 15:55, Dotan Cohen wrote: > I am using a Debian-based distro (Ubuntu). Often I need to use the > output of one terminal command as the input for another. A classic > example is the which command: > $ which firefox > /usr/bin/firefox > $ >

Re: Using terminal output as input

2009-05-14 Thread Dotan Cohen
> Also note that > > $(ekiga | head -2 | tail -1) > > is a more portable equivalent.  $() is the same as `` but unlike `` can > be nested, and has less quoting issues.  You can enclose it in > double quotes, for example since it behaves like a variable expansion. > That also does not work on Debia

Re: Using terminal output as input

2009-05-14 Thread Dotan Cohen
> Not pretty but how about > `ekiga | head -2 | tail -1` > > (note use of backticks) > That's creative! It doesn't seem to work on this system, I will try on Real Debian (tm) when I get home. However, it does require foreknowledge of the output, which I suppose is all right if the user can run the

Re: Using terminal output as input

2009-05-14 Thread Roger Leigh
On Thu, May 14, 2009 at 11:08:14AM -0400, S Scharf wrote: > On Thu, May 14, 2009 at 10:55 AM, Dotan Cohen wrote: > > > I am using a Debian-based distro (Ubuntu). Often I need to use the > > output of one terminal command as the input for another. A classic > > example is the which command: > > $

Re: Using terminal output as input

2009-05-14 Thread S Scharf
On Thu, May 14, 2009 at 10:55 AM, Dotan Cohen wrote: > I am using a Debian-based distro (Ubuntu). Often I need to use the > output of one terminal command as the input for another. A classic > example is the which command: > $ which firefox > /usr/bin/firefox > $ > > Now, I would like to use tha

Re: Using terminal output as input

2009-05-14 Thread Dotan Cohen
> do you mean using the back-quote > `which firefox` > the above command will fire the firefox command Thanks, Bhasker. I meant to ask, in the more general sense, how to use the terminal output as input. The second example in the OP describes that more. -- Dotan Cohen http://what-is-what.com ht

Re: Using terminal output as input

2009-05-14 Thread Bhasker C V
On Thu, 14 May 2009, Dotan Cohen wrote: I am using a Debian-based distro (Ubuntu). Often I need to use the output of one terminal command as the input for another. A classic example is the which command: $ which firefox /usr/bin/firefox $ do you mean using the back-quote `which firefox` the a

Using terminal output as input

2009-05-14 Thread Dotan Cohen
I am using a Debian-based distro (Ubuntu). Often I need to use the output of one terminal command as the input for another. A classic example is the which command: $ which firefox /usr/bin/firefox $ Now, I would like to use that output as input, to start firefox. Other than manually typing it in,