Group-39 PPT Linux

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

PS-III [LINUX]

FILTERS IN LINUX
WHAT ARE FILTERS?

- Filters are programs that take


plain text(either stored in a file
or produced by another
program) as standard input,
transforms it into a meaningful
format, and then returns it as
standard output.

- Linux Filter commands accept


input data from stdin (standard
input) and produce output on
stdout (standard output). It
transforms plain-text data into a
meaningful way and can be used
with pipes to perform higher
operations.

TYPES OF FILTERS IN
LINUX
- There are Mainly 12
Type of Filters:
-
1.
Some of them are
Cat
2. Cut
3. Grep
4. Comm
5. Sort
6. Uniq

1.CAT
- Displays the text of the file line
by line.

- When cat command is used


inside pipes, it does nothing
except moving stdin to stout.

- Syntax:
cat <fileName> | cat or tac |
  cat or tac |.

- Example:
- cat weeks.txt| tac | cat | cat
| tac

2.COMM
- The Comm Command compares
two files or streams.
- By default ‘comm’ will always
display three columns.
- First column displays non
matching files of first file, second
column indicates non matching
items of second file, and third
column indicates matching items
of both the files.
- Both the files has to be sorted
order for ‘comm’ command to be
executed
- Syntax: comm <file1> <file2>
- Example: comm file1.txt
file2.txt

3.TR
- The Command ‘tr’ stands
for ‘translate’.
- It is used to translate, like
from lowercase to
uppercase and vice versa
or new lines into spaces.
- Syntax:
command | tr <‘old> <‘new’>
- Example:
cat exm.txt | tr ‘prcu’ ‘PRCU’

4.OD
- The ‘od’ terms stands for octal dump.
- It displays content of a file in different
human readable formats like
hexadecimal, octal and ASCII
characters.
- Syntax:

- Example

5.SORT
- The Linux ‘SORT’
command sorts the file
content in an
alphabetical order .
- Syntax
sort <fileName>
- Example
sort weeks.txt

6.GZIP
- Gzip (GNU Zip) is a
compressing tool, which is
used to truncate the file size.
- By default original file size will
be replaced by the
compressed file ending with
extension (.gz).
- To decompress a file you can
use gunzip command and
your original file will be back.
- Syntax
gzip <file1> <file2> <file3>
gunzip <file1> <file2> <file3>
- Example
gzip file1.txt file2.txt
gunzip file1.txt file2.txt

CONCLUSION
IN COMPUTER PROGRAMMING, A FILTER IS A PROGRAM OR
SECTION OF CODE THAT IS DESIGNED TO EXAMINE EACH
INPUT OR OUTPUT REQUEST FOR CERTAIN QUALIFYING
CRITERIA AND THEN PROCESS OR FORWARD IT ACCORDINGLY.
THIS TERM WAS USED IN UNIX SYSTEMS AND IS NOW USED IN
OTHER OPERATING SYSTEMS.

REFERENCES
https://www.javatpoint.com/linux-filters
https://www.geeksforgeeks.org/filters-in-linux/amp/

THANK YOU! GROUP 39


SINGH AKARSH-30
VERMA SUYASH-50
RAINA ANSHIT-04

You might also like