- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: file with duplication ignor anything where the...
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
тАО12-20-2006 04:05 AM
тАО12-20-2006 04:05 AM
See below:
aanderson
abergman
abergman
aboell
aboell
abone
abridwell
abridwell
aburks
achowdhury
for records containing duplicates I want to ignor these all together and only get the records where there is a single record..
The file is an a-z so I can't just do a simple grep ignor..
Any insight appreciated..
Rex Mueller - Unix System ESU#3
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2006 04:08 AM
тАО12-20-2006 04:08 AM
Re: file with duplication ignor anything where there is a duplicate.
since it seems, that the file is sorted, you can use 'uniq' (see man page).
mfG Peter
- Tags:
- uniq
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2006 04:08 AM
тАО12-20-2006 04:08 AM
Re: file with duplication ignor anything where there is a duplicate.
since it seems that the file is sorted, you can use 'uniq' (see man page).
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2006 04:17 AM
тАО12-20-2006 04:17 AM
Re: file with duplication ignor anything where there is a duplicate.
# cat ./report
#!/usr/bin/perl
use strict;
use warnings;
my %names;
my $key;
while (<>) {
$names{$_}++;
}
for $key (sort keys %names) {
print $key if $names{$key} == 1;
}
1;
...run as:
# ./report filename
Regards!
...JRF...
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2006 05:10 AM
тАО12-20-2006 05:10 AM
Solution# awk '{x[$1]++}END{for(i in x) if(x[i]==1) print i}' file
- Tags:
- awk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2006 05:16 AM
тАО12-20-2006 05:16 AM
Re: file with duplication ignor anything where there is a duplicate.
If you prefer, the Perl script I offered can be reduced to a commandline script:
# perl -ne '$names{$_}++;END{for $key (sort keys %names) {print $key if $names{$key}==1}}' filename
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2006 05:20 AM
тАО12-20-2006 05:20 AM
Re: file with duplication ignor anything where there is a duplicate.
sort filename | uniq > outfilename
would work for you?
- Tags:
- Sort
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2006 05:25 AM
тАО12-20-2006 05:25 AM
Re: file with duplication ignor anything where there is a duplicate.
I tried the script the names and duplicates remain.. Any ideas?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2006 05:36 AM
тАО12-20-2006 05:36 AM
Re: file with duplication ignor anything where there is a duplicate.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-20-2006 05:38 AM
тАО12-20-2006 05:38 AM
Re: file with duplication ignor anything where there is a duplicate.
THANKS!! Kudos to all