- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: sort question
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
Forums
Discussions
Discussions
Discussions
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
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
09-07-2005 03:37 AM
09-07-2005 03:37 AM
I am looking for something to give result like
NodeA
NodeB
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2005 03:41 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2005 03:43 AM
09-07-2005 03:43 AM
Re: sort question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2005 03:45 AM
09-07-2005 03:45 AM
Re: sort question
you can use this:
myinfile=/path/somefilename
outfile=/path/myoutfilename
#in case multiple host names on one line we'll separate them
for h in `cat $myinfile`
do
echo $h > /tmp/temphostfile
done
for host in `cat /tmp/temphostfile|sort|uniq`
do
ct=`grep $host /tmp/hostfile |wc -l`
echo $host" "$count >> $outfile
done
if you can provide a section of your input file, you can get more sensible answers
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2005 03:47 AM
09-07-2005 03:47 AM
Re: sort question
NodeA
NodeC
NodeB
NodeB
NodeC
NodeA
NodeA
NodeA
NodeA
NodeC
NodeC
running the script
sort node.dat|uniq |while read node;do
echo "$node = \c"
echo "`grep $node node.dat |wc -l`"
done
produces
NodeA = 5
NodeB = 2
NodeC = 4