From 1a2add11bd1a52f8374d3d6e5179d82d072c185b Mon Sep 17 00:00:00 2001
From: iabhee <32317996+iabhee@users.noreply.github.com>
Date: Sun, 29 Oct 2017 11:53:44 -0700
Subject: [PATCH 1/9] Add Tee to the table of contents
---
tail_less_cat_head.md | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tail_less_cat_head.md b/tail_less_cat_head.md
index 26b5afd..6af9478 100644
--- a/tail_less_cat_head.md
+++ b/tail_less_cat_head.md
@@ -27,6 +27,14 @@
* [combining head and tail](#combining-head-and-tail)
* [Further Reading for head](#further-reading-for-head)
* [Text Editors](#text-editors)
+* [Tee](#Store-and-view-the-output-at-the-same-time)
+ * [Write output to stdout, and also to a file](#command-usage)
+ * [Write the output to two commands](#command-usage)
+ * [Misc Tee Command Operations](#command-usage)
+
+
+
+
From b7bd4c87f1b6e20536ab66a1fd123cc1504afff4 Mon Sep 17 00:00:00 2001
From: iabhee <32317996+iabhee@users.noreply.github.com>
Date: Sun, 29 Oct 2017 12:02:42 -0700
Subject: [PATCH 2/9] Update tail_less_cat_head.md
---
tail_less_cat_head.md | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/tail_less_cat_head.md b/tail_less_cat_head.md
index 6af9478..9f28be0 100644
--- a/tail_less_cat_head.md
+++ b/tail_less_cat_head.md
@@ -1,4 +1,4 @@
-# Cat, Less, Tail and Head
+# Cat, Less, Tail, Head and Tee
**Table of Contents**
@@ -688,3 +688,15 @@ Powerful text editors
* [sublime](https://www.sublimetext.com/)
Check out [this analysis](https://github.com/jhallen/joes-sandbox/tree/master/editor-perf) for some performance/feature comparisons of various text editors
+
+
+## Tee
+
+ The following command displays output only on the screen (stdout).
+ $ ls
+
+ The following command writes the output only to the file and not to the screen.
+ $ ls > file
+
+ The following command (with the help of tee command) writes the output both to the screen (stdout) and to the file.
+ $ ls | tee file
From 051eddb28022cce55cd4ac8de8641a11589736de Mon Sep 17 00:00:00 2001
From: iabhee <32317996+iabhee@users.noreply.github.com>
Date: Sun, 29 Oct 2017 12:04:25 -0700
Subject: [PATCH 3/9] Update tail_less_cat_head.md
---
tail_less_cat_head.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tail_less_cat_head.md b/tail_less_cat_head.md
index 9f28be0..66fd52d 100644
--- a/tail_less_cat_head.md
+++ b/tail_less_cat_head.md
@@ -691,7 +691,7 @@ Check out [this analysis](https://github.com/jhallen/joes-sandbox/tree/master/ed
## Tee
-
+```
The following command displays output only on the screen (stdout).
$ ls
@@ -700,3 +700,4 @@ Check out [this analysis](https://github.com/jhallen/joes-sandbox/tree/master/ed
The following command (with the help of tee command) writes the output both to the screen (stdout) and to the file.
$ ls | tee file
+```
From 67d36309e1ddabb5493c3eb66c87658b4028f7c1 Mon Sep 17 00:00:00 2001
From: iabhee <32317996+iabhee@users.noreply.github.com>
Date: Sun, 29 Oct 2017 20:22:56 -0700
Subject: [PATCH 4/9] Updated commands
---
tail_less_cat_head.md | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/tail_less_cat_head.md b/tail_less_cat_head.md
index 66fd52d..60d22bc 100644
--- a/tail_less_cat_head.md
+++ b/tail_less_cat_head.md
@@ -691,6 +691,8 @@ Check out [this analysis](https://github.com/jhallen/joes-sandbox/tree/master/ed
## Tee
+
+## Write output to stdout, and also to a file
```
The following command displays output only on the screen (stdout).
$ ls
@@ -701,3 +703,24 @@ Check out [this analysis](https://github.com/jhallen/joes-sandbox/tree/master/ed
The following command (with the help of tee command) writes the output both to the screen (stdout) and to the file.
$ ls | tee file
```
+
+## Write the output to two commands
+```
+ You can also use tee command to store the output of a command to a file and redirect the same output as an input to another command.
+
+ The following command will take a backup of the crontab entries, and pass the crontab entries as an input to sed command which will do the substituion. After the substitution, it will be added as a new cron job.
+
+ $ crontab -l | tee crontab-backup.txt | sed 's/old/new/' | crontab –
+```
+
+## Misc Tee Command Operations
+```
+ By default tee command overwrites the file. You can instruct tee command to append to the file using the option –a as shown below.
+
+ $ ls | tee –a file
+
+ You can also write the output to multiple files as shown below.
+
+ $ ls | tee file1 file2 file3
+
+```
From 69a31a463a2e379a333dcf73c57b68eb254a073d Mon Sep 17 00:00:00 2001
From: iabhee <32317996+iabhee@users.noreply.github.com>
Date: Sun, 29 Oct 2017 20:27:59 -0700
Subject: [PATCH 5/9] Update tail_less_cat_head.md
---
tail_less_cat_head.md | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/tail_less_cat_head.md b/tail_less_cat_head.md
index 60d22bc..7f0b688 100644
--- a/tail_less_cat_head.md
+++ b/tail_less_cat_head.md
@@ -27,10 +27,10 @@
* [combining head and tail](#combining-head-and-tail)
* [Further Reading for head](#further-reading-for-head)
* [Text Editors](#text-editors)
-* [Tee](#Store-and-view-the-output-at-the-same-time)
- * [Write output to stdout, and also to a file](#command-usage)
- * [Write the output to two commands](#command-usage)
- * [Misc Tee Command Operations](#command-usage)
+* [Tee](#Tee)
+ * [Write output to stdout, and also to a file](#output-to-stdout)
+ * [Write the output to two commands](#output-to-two-commands)
+ * [Misc Tee Command Operations](#Misc)
@@ -692,7 +692,7 @@ Check out [this analysis](https://github.com/jhallen/joes-sandbox/tree/master/ed
## Tee
-## Write output to stdout, and also to a file
+## output-to-stdout
```
The following command displays output only on the screen (stdout).
$ ls
From 1df42f9459a649257ecb9e4ab49df5f03b895a47 Mon Sep 17 00:00:00 2001
From: iabhee <32317996+iabhee@users.noreply.github.com>
Date: Sun, 29 Oct 2017 20:29:28 -0700
Subject: [PATCH 6/9] Update tail_less_cat_head.md
---
tail_less_cat_head.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tail_less_cat_head.md b/tail_less_cat_head.md
index 7f0b688..f3c0922 100644
--- a/tail_less_cat_head.md
+++ b/tail_less_cat_head.md
@@ -692,7 +692,7 @@ Check out [this analysis](https://github.com/jhallen/joes-sandbox/tree/master/ed
## Tee
-## output-to-stdout
+## output-to-stdout
```
The following command displays output only on the screen (stdout).
$ ls
From 8e095c1411b4d3aef4cb9f3448a8d46dff1b2c63 Mon Sep 17 00:00:00 2001
From: iabhee <32317996+iabhee@users.noreply.github.com>
Date: Sun, 29 Oct 2017 20:30:18 -0700
Subject: [PATCH 7/9] Update tail_less_cat_head.md
---
tail_less_cat_head.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tail_less_cat_head.md b/tail_less_cat_head.md
index f3c0922..9894776 100644
--- a/tail_less_cat_head.md
+++ b/tail_less_cat_head.md
@@ -692,7 +692,7 @@ Check out [this analysis](https://github.com/jhallen/joes-sandbox/tree/master/ed
## Tee
-## output-to-stdout
+## Write output to stdout, and also to a file
```
The following command displays output only on the screen (stdout).
$ ls
From 3602c7747c8858a3642b2467e699dbc50d953783 Mon Sep 17 00:00:00 2001
From: iabhee <32317996+iabhee@users.noreply.github.com>
Date: Sun, 29 Oct 2017 20:31:10 -0700
Subject: [PATCH 8/9] final update
---
tail_less_cat_head.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tail_less_cat_head.md b/tail_less_cat_head.md
index 9894776..b29054b 100644
--- a/tail_less_cat_head.md
+++ b/tail_less_cat_head.md
@@ -704,7 +704,7 @@ Check out [this analysis](https://github.com/jhallen/joes-sandbox/tree/master/ed
$ ls | tee file
```
-## Write the output to two commands
+## Write the output to two commands
```
You can also use tee command to store the output of a command to a file and redirect the same output as an input to another command.
@@ -713,7 +713,7 @@ Check out [this analysis](https://github.com/jhallen/joes-sandbox/tree/master/ed
$ crontab -l | tee crontab-backup.txt | sed 's/old/new/' | crontab –
```
-## Misc Tee Command Operations
+## Misc Tee Command Operations
```
By default tee command overwrites the file. You can instruct tee command to append to the file using the option –a as shown below.
From 98f1153fecedd751bfd6c82a64c9bb96f9d88017 Mon Sep 17 00:00:00 2001
From: iabhee <32317996+iabhee@users.noreply.github.com>
Date: Sun, 29 Oct 2017 20:32:49 -0700
Subject: [PATCH 9/9] formatting changes
---
tail_less_cat_head.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tail_less_cat_head.md b/tail_less_cat_head.md
index b29054b..4727dcb 100644
--- a/tail_less_cat_head.md
+++ b/tail_less_cat_head.md
@@ -692,7 +692,7 @@ Check out [this analysis](https://github.com/jhallen/joes-sandbox/tree/master/ed
## Tee
-## Write output to stdout, and also to a file
+### Write output to stdout, and also to a file
```
The following command displays output only on the screen (stdout).
$ ls
@@ -704,7 +704,7 @@ Check out [this analysis](https://github.com/jhallen/joes-sandbox/tree/master/ed
$ ls | tee file
```
-## Write the output to two commands
+### Write the output to two commands
```
You can also use tee command to store the output of a command to a file and redirect the same output as an input to another command.
@@ -713,7 +713,7 @@ Check out [this analysis](https://github.com/jhallen/joes-sandbox/tree/master/ed
$ crontab -l | tee crontab-backup.txt | sed 's/old/new/' | crontab –
```
-## Misc Tee Command Operations
+### Misc Tee Command Operations
```
By default tee command overwrites the file. You can instruct tee command to append to the file using the option –a as shown below.