Navigation Menu

Currently the navigation bar is not functioning. Use the Blog Archive or the Google Custom Search to find content.

Tuesday 2 July 2013

Using filters in Linux

Examples based on filters in Linux.

Links that you may find important :

Sort :

http://linux.about.com/library/cmd/blcmdl1_sort.htm
http://linux.about.com/od/commands/a/Example-Uses-Of-The-Command-Sort.htm
https://www.ibm.com/developerworks/community/blogs/58e72888-6340-46ac-b488-d31aa4058e9c/entry/linux_sort_command_sort_lines_of_text_files9?lang=en
linux.die.net/man/1/sort

Tee :

http://linux.about.com/library/cmd/blcmdl1_tee.htm
http://linux.die.net/man/1/tee
http://linux.101hacks.com/unix/tee-command-examples/

Grep :

http://linux.about.com/od/commands/l/blcmdl1_grep.htm
http://linux.die.net/man/1/grep
https://en.wikipedia.org/wiki/Grep

Fgrep :

http://linux.about.com/library/cmd/blcmdl1_fgrep.htm
http://linux.die.net/man/1/fgrep
http://www.computerhope.com/unix/ufgrep.htm

Egrep :

http://linux.about.com/library/cmd/blcmdl1_egrep.htm
http://linux.die.net/man/1/egrep
http://linux.101hacks.com/unix/egrep/
http://www.computerhope.com/unix/uegrep.htm
http://www.hscripts.com/tutorials/linux-commands/egrep.html

Cut :

http://linux.about.com/od/commands/l/blcmdl1_cut.htm
http://www.computerhope.com/unix/ucut.htm
http://linux.101hacks.com/linux-commands/cut-command-examples/
http://www.hscripts.com/tutorials/linux-commands/cut.html

Wc :

http://linux.about.com/library/cmd/blcmdl1_wc.htm
http://linux.die.net/man/1/wc
http://www.computerhope.com/unix/uwc.htm
http://en.wikipedia.org/wiki/Wc_%28Unix%29

Uniq :

http://linux.about.com/library/cmd/blcmdl1_uniq.htm
http://linux.about.com/library/cmd/blcmdl_uniq.htm
http://linux.die.net/man/1/uniq
http://www.computerhope.com/unix/uuniq.htm
http://linux.101hacks.com/linux-commands/uniq-command-examples/

Create a file with the name names.

File : names
John
Ron
Harry
Maverick
Brown
Aaron
Commands and Output :
cat names | sort -r
Ron
Maverick
John
Harry
Brown
Aaron

cat names | tee copy
John
Ron
Harry
Maverick
Brown
Aaron

Cat copy
John
Ron
Harry
Maverick
Brown
Aaron

cat names | grep -n "o"
1:John
2:Ron
5:Brown
6:Aaron

cat names | egrep -ni "[ o | h ]"
1:John
2:Ron
3:Harry
5:Brown
6:Aaron

cat names | fgrep -ni "
> rr
> ro
> v"
1:John
2:Ron
3:Harry
4:Maverick
5:Brown
6:Aaron

cat names | wc -lwm
      6       6      35

cat names | uniq -d
cat names | uniq -u
John
Ron
Harry
Maverick
Brown
Aaron

cat names | cut -c1-4
John
Ron
Harr
Mave
Brow
Aaro

Note : Leave a comment if you feel the program is incorrect and/or has errors and/or if the program and its output don't match. Please report about broken links.

No comments:

Post a Comment