- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Format
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
08-10-2004 09:18 AM
08-10-2004 09:18 AM
Format
How to delete unique lines based on particular field?
word1 TIME word2 tdce-512 word4
word1 TIME word2 tdce-512 word4
word1 TIME word2 tdce-512 word4
word1 TIME word2 tdce-513 word4
word1 TIME word2 tdce-517 word4
I want to delete duplicate lines based on fourth field.
Any help is appreciated.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2004 09:21 AM
08-10-2004 09:21 AM
Re: Format
sort -u -k4 filename
Jeff Traigle
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2004 09:22 AM
08-10-2004 09:22 AM
Re: Format
sort -buk 4 < input-file > output-file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2004 10:08 AM
08-10-2004 10:08 AM
Re: Format
If you need to keep the original order, yet must only retain the first of a duplicate then you can use a perl (or awk) script like:
perl -ne '$x=(split)[3];next if $seen{$x};$seen{$x}++;print' file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2004 03:04 AM
08-11-2004 03:04 AM
Re: Format
Hmmm, you assigned 4 points to each solutions presented, suggesting that you did evaluate them, but that they did NOT solve your problem.
Maybe you can clarify what is missing based on the results from the earlier replies? Maybe a more clear 'before' and 'after' picture, perhaps in a text attachment, is needed?
Regards,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2004 03:20 AM
08-11-2004 03:20 AM
Re: Format
awk '{if (x != $4) { print $0}; x=$4}'
HTH
-- Rod Hills