- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: How to print duplicate lines alone
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
03-20-2003 09:18 AM
03-20-2003 09:18 AM
When I tried 'uniq -c', tt prints number of times and line. For eg.
$ uniq -c serrlog
1 error 04: connection failure
4 error 11: /tmp directory not found
1 error 17: low disk space
2 error 22: out of memory
Instead of printing just number of times, I need to have print
I am not sure this option is available on any command on the unix.
Thank you
Regards
Nesan
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2003 09:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2003 09:46 AM
03-20-2003 09:46 AM
Re: How to print duplicate lines alone
Did you try 'uniq -d' ?
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2003 09:51 AM
03-20-2003 09:51 AM
Re: How to print duplicate lines alone
I'm not quite sure what you're after as it looks like you chopped off part of your question ;)
If you want to see all unique lines plus one copy of the duplicates, without the number of duplicates at the front then you should use:
uniq serrlog
This is equivalent to uniq -ud serrlog. The -c option is adding the numbers.
uniq -d serlog will give you one line for each duplicate - without numbers.
regards,
Darren.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2003 10:31 AM
03-20-2003 10:31 AM
Re: How to print duplicate lines alone
integer N
uniq -c serrlog | {
while read N LINE
do
while (( N > 0 ));
do
print -- "${LINE}"
let N=N-1
done
done
}
Regards,
John