Pipe?

closed account (48bpfSEw)
How is this technique with this | sign called in Unix and how can I implement?

cat | sort > out.txt

Background: my wordchecker does not sort and filter dublicates and I am too lazy to code it since there are tools in DOS to sort and filter (grep) lines.
A filter is a program that reads its input (typically, text) from stdin, and writes its output (text) to stdout.

For instance, a filter that reverses lines:
1
2
3
4
5
6
7
8
9
#include <iostream>
#include <string>

int main()
{
    std::string line ;
    while( std::getline( std::cin, line ) )
       std::cout << std::string( line.rbegin(), line.rend() ) << '\n' ;
}

http://coliru.stacked-crooked.com/a/00ec4891acf7f92f
closed account (48bpfSEw)
thank you!! it realy works!

DOS:

c:> wordchecker | grep "PROJ"

puts me all the lines out with "PROJ"! .... coool! ^^
Topic archived. No new replies allowed.