Web lists-archives.com

Re: gathering trace rute output to a file?




On 7/1/2018 8:19 PM, mick crane wrote:
On 2018-07-01 06:00, Karen Lewellen wrote:
Well it seems   it works like this.
traceroute domain-to-be-traced.com > trace-results.txt
or something like that.
process worked for me just now.
Thanks as usual,
Karen

I'm asking 'cause I don't really know.
What's the difference between a pipe "|" and sending the result somewhere ">" ?


The pipe operator '|' will pass the output of one command to an other:

$ ls | grep txt

In the example above the output is passed from the ls command to the grep command and grep will search for the expression 'txt'.

The redirection operator '>' will redirect the output to a "file, the file could be:
- file descriptor
- null device (/dev/null)
- regular file

One '>' will create the file if it does not exist or if it exist '>' will truncate the file to zero size ("empty the file").
Two '>' will append to the file.

$ echo test > test.txt -- Only test will be in the file test.txt
$ echo test >> test.txt -- If text.txt already exist "test" will be added to the end of the file otherwise "test.txt" will be created with only "test" in it.

--
John Doe