If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > > file2 < file1 cat

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-18-04, 10:21
Daryl Lim Daryl Lim is offline
Registered User
 
Join Date: May 2004
Posts: 11
> file2 < file1 cat

Hi all,

thanks Damian and vgersh99 for answering my sed question,

can i check this command which surprise me why cn cat be place at the end of the command

> file2 < file1 cat

i ran and find that the contents of file1 are copied to file2.

thanks
daryl
Reply With Quote
  #2 (permalink)  
Old 06-18-04, 11:20
Damian Ibbotson Damian Ibbotson is offline
Padawan
 
Join Date: Jun 2002
Location: UK
Posts: 525
The command is actually shorthand for...

1>file2 0<file1 cat

This means:

Send standard output (which is file descriptor 1 by default) to file2.
Read standard input (which is file descriptor 0 by default) from file1.
These conditions are now set for the following 'cat' command, so cat reads standard input from file1 and sends its output to file2.

The results is the contents of file1 are 'copied' to file2.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On