Thursday, August 27, 2015

Input output redirection and filter

1. Redirect the output of a command to a file
Note: If you have existing file, it will be over written
$ [cmd] > [file]

2. Redirect and append the output of a command to a file.
Note: Existing file content will not be over written.
$ [cmd] >> [file]

3. Input redirection to a command from a file
$ [cmd] < [file]

4. Input redirection to a command from file1 and output to file2
$ [cmd] < [file1] > [file2]

5. Redirect output of one command into a second command (pipes)
$ [cmd1] | [cmd2]

Redirect filter to,
7. Sort standard input to standard output
$ [cmd] | sort

8. Examine input for specific lines of characters and return matching lines to standard output
$ [cmd] | grep string

9. Examine input for adjacent duplicates and return unique lines to standard output
$ [cmd] | uniq

10. Read text from standard input and return formated text to standard output
$ [cmd] | fmt

11. Format standard input with page breaks, headers, footers, etc for output to a printer
$ [cmd] | pr

12. Return first 10 lines of input to standard output
$ [cmd] | head

13. Return last 10 lines of input to standard output
$ [cmd] | tail

14. Translate, sqeeze, or delete characters of standard input to standard output
$ [cmd] | tr

15. Stream edit standard input and return to standard output
$ [cmd] | sed

16. Process standard input with gawk pattern scanning and programming language and return standard output
$ [cmd] | awk

17. Display standard input one page at a time
$ [cmd] | more

18. Display standard input with scroll and search capability
$ [cmd] | less

No comments:

Post a Comment