Could someone please tell me the difference between the different piping characters e.g |, >>, > Thanks Ray Booysen
On Sat, May 26, 2001 at 09:09:49AM +0200, rjb-dis@iafrica.com wrote:
Could someone please tell me the difference between the different piping characters e.g |, >>, >
1 command < file Take input from 'file' and use it as standard input for command. 2 command << TEXT Generally used in scripts. Take input from next line onwards as standard input for command, until line "TEXT". 3 command > file Take standard output from commmand and write to file, overwriting contents. 4 command >> file Take standard output from commmand and append to file. 5 command1 | command2 Take standard output from commmand1 and use as standard input for command2. In C shell, you can use "&" with 3, 4 and 5, which lumps standard error in with standard output and "!" with 3 which overrides the setting of noclobber, or with 4 which creates the file if it doesn't exist. Bourne shell has more sophisticated handling of these things; I suggest you RTFM for this. -- David Smith Tel: +44 (0)1454 462380 (direct) STMicroelectronics Fax: +44 (0)1454 617910 1000 Aztec West TINA (ST only): (065) 2380 Almondsbury Home: 01454 616963 BRISTOL Mobile: 07932 642724 BS32 4SQ Work Email: Dave.Smith@st.com Home Email: David.Smith@ds-electronics.co.uk
Takes the result from your command (the output) and puts it in a new file
Hi, Here is the difference: | Basically PIPEs the command structures together. that you specifiy( find / -name httpd.conf > myConf.txt).
Takes the result from your command (the output) and appends it to an existing file or creates the file if it doesn't exist.
I hope this helps Q On Sat 26 May 01 09:09, Ray Booysen wrote:
Could someone please tell me the difference between the different piping characters e.g |, >>, >
Thanks Ray Booysen
On Saturday 26 May 2001 09:09, you wrote:
Could someone please tell me the difference between the different piping characters e.g |, >>, >
Thanks Ray Booysen
The pipe "|" places the standard output of one program into the standard input of a second. For example `ls -lF /dev | less` will pipe the standard output of ls (a long list of device files in /dev) to the standard input of less, which will allow you to page through all the files in your /dev directory. ">" redirects the output to a file, such as an error log or /dev/null. ">>" redirects the output to a file, but instead of overwriting the file like ">" does, it appends it to the file. That's down and dirty, and probably oversimplified, but it should get you in the ballpark. I am standing by for possible corrections/refinements from our more learned listmates. Cheers, Sean -- Theo. Sean Schulze theo.schulze@myokay.net "[T]he key to maintaining leadership in the economy and the technology that are about to emerge is likely to be the social position of knowledge professionals and social acceptance of their values." -- Peter Drucker
participants (4)
-
Dave Smith
-
Quinton Delpeche
-
Ray Booysen
-
Theo. Sean Schulze