- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Text filtering and formatting .....
Categories
Company
Local Language
Forums
Discussions
Knowledge Base
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Knowledge Base
Forums
Discussions
- Cloud Mentoring and Education
- Software - General
- HPE OneView
- HPE Ezmeral Software platform
- HPE OpsRamp
Knowledge Base
Discussions
Forums
Discussions
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
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