- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Text filtering and formatting .....
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-29-2001 10:39 PM
тАО08-29-2001 10:39 PM
text file after sorting .
ex:
1111
2222
2222
3333
3333
I need to have only
1111
2222
3333
2.How do I sort lines in a file based on the
length of the line.
ex:
234
eqwr
45678
dfghhjk
cheers
Karthik ...
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-29-2001 10:46 PM
тАО08-29-2001 10:46 PM
Re: Text filtering and formatting .....
For you first question use "uniq" command
(man uniq). For example :
uniq foo.txt | sort
HTH
Herv?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-29-2001 11:07 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-29-2001 11:12 PM
тАО08-29-2001 11:12 PM
Re: Text filtering and formatting .....
Another way for the first question :
sort -u foo.txt
(-u : like uniq command)
For the second question try something like :
line_size.sh :
#!/bin/sh
for line in `sort -u $1`
do
echo `echo $line | wc -c` $line
done
And after use :
line_size.sh foo.txt | sort -k 1,1n | cut -f2 -d' '
HTH
Herv?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-30-2001 07:12 AM
тАО08-30-2001 07:12 AM
Re: Text filtering and formatting .....
Cat text1 > text
cat text1 >> text
sort text |uniq -d
Try this cheap method out.
-Sri