Filter in Linux

By: Vivek G. Emailed: 1607 times Printed: 2079 times    

Latest comments
By: rohit kumar - how this program is work
By: Kirti - Hi..thx for the hadoop in
By: Spijker - I have altered the code a
By: ali mohammed - why we use the java in ne
By: ali mohammed - why we use the java in ne
By: mizhelle - when I exported the data
By: raul - no output as well, i'm ge
By: Rajesh - thanx very much...
By: Suindu De - Suppose we are executing

If a Linux command accepts its input from the standard input and produces its output on standard output is know as a filter. A filter performs some kind of process on the input and gives output. For e.g.. Suppose you have file called 'hotel.txt' with 100 lines data, And from 'hotel.txt' you would like to print contains from line number 20 to line number 30 and store this result to file called 'hlist' then give command:
$ tail +20 < hotel.txt | head -n30 >hlist

Here head command is filter which takes its input from tail command (tail command start selecting from line number 20 of given file i.e. hotel.txt) and passes this lines as input to head, whose output is redirected to 'hlist' file.

Consider one more following example
$ sort < sname | uniq > u_sname

Here uniq is filter which takes its input from sort command and passes this lines as input to uniq; Then uniqs output is redirected to "u_sname" file.


Linux Home | All Linux Tutorials | Latest Linux Tutorials

Sponsored Links

If this tutorial doesn't answer your question, or you have a specific question, just ask an expert here. Post your question to get a direct answer.



Bookmark and Share

Comments(0)


Be the first one to add a comment

Your name (required):


Your email(required, will not be shown to the public):


Your sites URL (optional):


Your comments:



More Tutorials by Vivek G.
Filter in Linux
Pipes in Linux
Input - Output redirection in Linux Shell Script
read Statement in Linux Shell Script
Exit Status in Linux Shell Script
Quotes in Linux Shell Script
Arithmetic in Linux Shell Script
echo Command in Linux Shell Script
How to print or access value of user defined variables in Linux Shell Script
Rules for Naming variable names in Linux Shell Script
How to define User defined variables in Linux Shell Script
Variables in Linux Shell Script
How to write your first Shell Script in linux?
What is a Shell Script in linux?
How to use Linux?

More Tutorials in Linux
smskannel SMS gateway run in background
Running jar files in background in ssh window
Could not open '': No such file or directory at lib/ExtUtils/MM_Unix.pm line 2697
Can't locate ExtUtils/MakeMaker.pm in @INC ...
bash: make: command not found
apxs: command not found
bash: svn: command not found
make: Nothing to be done for `all'.
How to burn your CD / DVD ISO image using Media Creator (Adaptec/Roxio) on Windows
How to burn your CD / DVD ISO image using Nero Burning ROM (Ahead Software) on Windows
How to burn your CD / DVD ISO image using Nero Express (Ahead Software) on Windows
How to burn your CD / DVD ISO image using NISO Recorder V2 Power Toy on Windows
How to burn your CD / DVD ISO image using k3b on CentOS
Compiling and Installing software from source in Linux
Installing RPM's using the Redhat Package Manager in Linux

More Latest News
Most Viewed Articles (in Linux )
Nested if-else-fi in Linux Shell Script
make: Nothing to be done for `all'.
What is a Shell Script in linux?
Pipes in Linux
Filter in Linux
sum of all digits in a given number using Shell Script
Check for leap year in Shell Script
Finding factorial in Shell Script
Formating text in Shell Script
How to burn your CD / DVD ISO image using Media Creator (Adaptec/Roxio) on Windows
How to burn your CD / DVD ISO image using Nero Express (Ahead Software) on Windows
Mounting cdrom in cent os 5 linux
How to use Linux?
How to write your first Shell Script in linux?
Variables in Linux Shell Script
Most Emailed Articles (in Linux)
if condition in Linux Shell Script
test command or [ expr ] in Linux Shell Script
How to burn your CD / DVD ISO image using Nero Burning ROM (Ahead Software) on Windows
smskannel SMS gateway run in background
Check if file exists in Shell Script
How to print or access value of user defined variables in Linux Shell Script
Quotes in Linux Shell Script
Nested if-else-fi in Linux Shell Script
while loop in Linux Shell Script
case..esac..in Linux Shell Script
sh -x and sh -v in Linux
Check for leap year in Shell Script
Formating text in Shell Script
Getting System Information in Shell Script
How to burn your CD / DVD ISO image using NISO Recorder V2 Power Toy on Windows