Mailinglist Archive: opensuse (5130 mails)

< Previous Next >
Re: [SLE] diff command and saving results to a file
  • From: Jerry Feldman <gaf@xxxxxxx>
  • Date: Sun, 28 May 2006 10:08:24 -0400
  • Message-id: <20060528100824.1f9faef5@xxxxxxxxxxx>
On Sat, 27 May 2006 17:32:53 +0200
Anders Johansson <andjoh@xxxxxxxxxx> wrote:

> On Saturday 27 May 2006 17:20, lerninlinux@xxxxxxxxxxx wrote:
> > How do I pipe the results to the text file? Is that "|" the command?
> You don't pipe to a file, you pipe to a command. To a file you "redirect"
> To redirect the output to a file you use the > operator, for example
> diff -u file1 file2 > outputfile

Just as a general point of information. Many of the Linux/Unix command
line utilities were designed to be simple commands receiving input from
the standard input, and output to standard output and errors to
standard error. As Anders mentions, you can redirect to a text file, or
pipe it into a utility.
In general, the redirect operators are:
> -- Redirect standard output to a file.
>> -- Append standard output to a file
< - Redirect standard input from a file
| - pipe the output to another program.

There are ways of redirecting standard error also, but they are a bit
shell-centric and will be different on C-Shell derivatives and Bourne
Shell derivatives.

Jerry Feldman <gaf@xxxxxxx>
Boston Linux and Unix user group PGP key id:C5061EA9
PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9
< Previous Next >