- >> and | are two completely different functions. One is used for text
manipulation, and one is used for program output manipulation. Create a file
called 'test.txt' with a line of random text in it for the following examples.
If you wanted to add text to the bottom of a file, you would use >>
# cat test.txt
# echo 'new text'>>test.txt
# cat test.txt
If you wanted to replace the text in a file, you would use >
# cat test.txt
# echo 'new text'>test.txt
# cat test.txt
Piping is used with programs, not text. You 'pipe' one program through the
other.
# rpm -qa
# rpm -qa|grep kernel
In the example above, we piped the output of a search for all the packages in
our system, through a 'grep' (search) for the word kernel.
-----
Note: If this answer resolves your problem, please remember to close this
question.
|