Sort >command Linux is used to sort text data. Sort command is often used with pipes symbol.
BEFORE SORTING
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
AFTER SORTING
[root@localhost ~]# grep bash /etc/passwd | sort
ananth:x:500:500:ananth:/home/ananth:/bin/bash
kumar:x:502:502::/home/kumar:/bin/bash
root:x:0:0:root:/root:/bin/bash
user12:x:503:503::/home/user12:/bin/bash
user1:x:501:501::/home/user1:/bin/bash
user2:x:504:504::/home/user2:/bin/bash
option
-r perform reverse sort with there command sort in Linux
-n perform a numeric sort
-u removes duplicate line in output
Friday, May 14, 2010
Linux Sort Command Sorting Text Ascending Order Descanting Order
Subscribe to:
Post Comments (Atom)
Labels
3D-2D Translation
Algorithms
Batch Programming
C language
C world
C++
DBMS
Ebook
Games
JAVA
Java Programs
JNTU MATERIALS
JNTU PREVIOUS QUESTION PAPERS
JNTU SYLLABUS BOOKS
LAB MANUALS
Linux
Mobile softwares
Networking
Online Programs
PC TIPS
Software Diagrams
Software Engineering
Softwares
System Software
Visual Basic
0 comments:
Post a Comment