standard input instead of input file

standard input instead of input file

Post by Alex Vinoku » Thu, 22 Jul 1999 04:00:00



Hi,

Consider the paste command.

paste requires input_file_name.

Using the command line
        paste `tty`
we can enter data from standard input.

Is there any other way to do it? (I would like to use pipe with paste).

        Thanks in advance,
        Alex

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

 
 
 

standard input instead of input file

Post by Dave Grantie » Thu, 22 Jul 1999 04:00:00




Quote:> Hi,

> Consider the paste command.

> paste requires input_file_name.

> Using the command line
>    paste `tty`
> we can enter data from standard input.

> Is there any other way to do it? (I would like to use pipe with
paste).

I don't follow.
Are you asking whether there's another way to read standard input from
the shell? (and maybe stick in a variable or pipe it to another tool?)
Can you use 'read' (man (0)sh) for that?

This seems too simple...I must not be following your question.

Cheers,
Dave

--
+---------------------+---------------+


+---------------------+---------------+

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

 
 
 

standard input instead of input file

Post by Pete Houst » Thu, 22 Jul 1999 04:00:00



|Using the command line
|       paste `tty`
|we can enter data from standard input.
|
|Is there any other way to do it? (I would like to use pipe with paste).

foo | paste -

It's in the man page (assuming GNU paste, since you don't say which
version),

                        Pete
--

PO Box 220, Whiteknights, Reading, | Phone: +44-118-9875123 ext 7594
Berkshire, RG6 6AF, United Kingdom | Fax:   +44-118-9750203                
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
WWW: http://www.rdg.ac.uk/~spr96phh/pete.html Use lynx - you know you want to!

 
 
 

standard input instead of input file

Post by Kurt J. Lanz » Thu, 22 Jul 1999 04:00:00



> Hi,

> Consider the paste command.

> paste requires input_file_name.

> Using the command line
>         paste `tty`
> we can enter data from standard input.

> Is there any other way to do it? (I would like to use pipe with paste).

1.      The way you have it written, you won't get standard input.
        You will get one line which is the device name for your
        terminal. You really ought to try your examples before writing
        them.

2.      The man page for paste quite clearly tells you how to get
        standard input. I leave it as an exercise for you to read
        same.

3.      It occurs to me that this might be a homework question, in
        which case [2] is even more relevant.

4.      Always read the man page first. The man pages are your friend.

 
 
 

standard input instead of input file

Post by Tobias Richt » Thu, 22 Jul 1999 04:00:00




>> paste requires input_file_name.

>> Using the command line
>>         paste `tty`
>> we can enter data from standard input.

>> Is there any other way to do it? (I would like to use pipe with paste).

>1.  The way you have it written, you won't get standard input.
>    You will get one line which is the device name for your
>    terminal. You really ought to try your examples before writing
>    them.

I see no reason why
Quote:>>         paste `tty`

should not work, in fact I just tried it successfully.
Could you explain?

tobias

Always RTFM.

 
 
 

standard input instead of input file

Post by Alex Vinoku » Fri, 23 Jul 1999 04:00:00






> >> paste requires input_file_name.

> >> Using the command line
> >>         paste `tty`
> >> we can enter data from standard input.

> >> Is there any other way to do it? (I would like to use pipe with
paste).

> >1.     The way you have it written, you won't get standard input.
> >       You will get one line which is the device name for your
> >       terminal. You really ought to try your examples before writing
> >       them.

  The example was tested before posting the message.

Quote:

> I see no reason why
> >>         paste `tty`
> should not work, in fact I just tried it successfully.

 Also I have got the same reults. I does work.

Quote:> Could you explain?

  Also I would like to get any explanation:
  1. Why must not it work?
  2. Why does it work?

Quote:

> tobias

> Always RTFM.

        Thanks in advance,
        Alex

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

 
 
 

standard input instead of input file

Post by Tobias Richt » Sat, 24 Jul 1999 04:00:00





>> I see no reason why
>> >>         paste `tty`
>> should not work, in fact I just tried it successfully.

> Also I have got the same reults. I does work.

>> Could you explain?

>  Also I would like to get any explanation:
>  1. Why must not it work?

After re-thinking it came clear to me that in fact
        paste `tty`
will not read from standard input, but from your
terminal. So e.g.
        paste `tty` < file
will fail.

Quote:>  2. Why does it work?

The way it works is:
'tty' give you the filename of your terminal.
the backticks (`) are a shell special for "replace
with output of enclosed command". So
        paste `tty`
invokes 'paste' with your tty name as single argument.

Bye,
tobias

 
 
 

standard input instead of input file

Post by Ken Pizzi » Tue, 27 Jul 1999 04:00:00




>   >The example was tested before posting the message.
>   >> I see no reason why
>   >> >>         paste `tty`
>   >> should not work, in fact I just tried it successfully.
>   >Also I have got the same reults. I does work.
>   >> Could you explain?
>   >Also I would like to get any explanation:
>   >1. Why must not it work?
>   >2. Why does it work?

>On your system, does "tty" give a filename for standard input, if the input
>comes from a source other than a terminal?  What happens if you type:
>echo "test" | tty
>tty < /etc/motd

>I can see how this might work, but it might not be portable to other Unix
>systems.

The `tty` command gets evaluated before the redirections occur.

                --Ken Pizzini

 
 
 

1. Redirecting input to a file - echo the input to screen/file?

Is it possible to have redirected input to a file also echoed to the
screen, or to a file?  For example, if I do something like the following:

$ ./program < input.txt > output.txt 2>&1

The output file shows everything coming out of the program (stdout and
stderr), but doesn't display the input.txt.

I tried adding 0>&1, but no-go (input hosed).

I can also cut and paste the input.txt file right in the shell, but it
doesn't show up for some reason in the shell (Redhat8.0).  Not sure what's
going on, any help appreciated.

2. Instal KdeBase package from source

3. File input to variable input

4. Help a computer student

5. << operator to append to a file from standard input

6. Proxy-ARP with netmask?

7. Redirecting Standard Input *TO* a file...

8. HPFS Filesystem...

9. How do you read standard input or a file list

10. Need way to prepend standard input to a file

11. Is input from file or standard in?

12. Trouble using rlogin with a file redirected to standard input

13. export `eval echo $"$INPUT"`=${input} not work on Sun Solaris 7