10-21-2008
sort and dedup problem
I have a file with contents:
1|4|oho hosfadu|
1|3|sdfsd fds|
2|2|sdfg|
2|1|sdf a|
3|5|ouhuh hu|
I would like to do three things to it;
1- first, sort it on the first two fields
2- get a unique count on the first field
3- and write the first two unique rows (uniqueness based off the 1st field) to a file:
Step 1:
1|3|sdfsd fds|
1|4|oho hosfadu|
2|1|sdf a|
2|2|sdfg|
3|5|ouhuh hu|
Step 2:
unique count = 3
Step 3:
1|3|sdfsd fds|
1|4|oho hosfadu|
2|1|sdf a|
2|2|sdfg|
Thanks,
- CB
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I am attempting to sort a file using the following command:
sort +0 -t"|" infilename > outfilename
I am getting the following error:
sort: 0653-657 A write error occurred while sorting.
The file size is 15036274 bytes
This is an AIX 5.2 version
I believe this is a problem with the... (1 Reply)
Discussion started by: jyoung
1 Replies
2. UNIX for Dummies Questions & Answers
Hello,
I tried to sort on column2 followed by column1 and notice how the "updated" value in column1 is not sorted correctly!
Can you tell me if i have the sort statement setup correctly please, thanks much!
sort -t "|" -k2 -k1 sortin > sortout
... (2 Replies)
Discussion started by: bobk544
2 Replies
3. Shell Programming and Scripting
there has several numbers which are:1,2,3,45,6,7,8,9,0,10,34,34,54,122,6756,54,87,99,2,1,45;
how to write a shell script orts the above numbers into descending order and puts them into and arrray and also find and prints the minimum and maximum of those numbers, and finds and prints the average... (4 Replies)
Discussion started by: sonicstage
4 Replies
4. Shell Programming and Scripting
I have file (srv_lst) with the contents as ...
9.2 IRMD115
8.1 IRMD115
and I am using the sort as to get the bigger version as :
sort -r -u +1 $srv_lst | sort -k 1,1r
and the output is 9.2 which is good ..
if I have the contents of file srv_lst as :
9.2 IRMD115
10.2 IRMD115
... (4 Replies)
Discussion started by: talashil
4 Replies
5. Programming
I am in need of some direction. First off I want to admit this is an assignment but I have hit a block. I need to sort, by the number of times a string occurs (count), and output the top 10. I have found what number gives me the top 10 so from there I need to know how to sort them. Any... (1 Reply)
Discussion started by: Cn00b
1 Replies
6. Shell Programming and Scripting
Hi all,
i want to sort by the (1-8) columns and (9-7) columns:
my file:
MARTINEZ---PAUL
--DUPOND---EDDY
--DURANDJACQUES
--DUPOND--ALAIN
output:
--DUPOND--ALAIN
--DUPOND---EDDY
--DURANDJACQUES
MARTINEZ---PAUL (6 Replies)
Discussion started by: saw7
6 Replies
7. UNIX for Advanced & Expert Users
Apologies if this should be in 'unix for dummies' thread..
I have a large file containing records like this:
16 Feb 02:49 s_A123_ctas_log.20100216024000.bin
26 Feb 02:55 s_B123_ctas_log.20100226024000.bin
05 Mar 05:22 s_A127_ctas_log.20100305024000.bin
I want to sort it by column 4... (2 Replies)
Discussion started by: Grueben
2 Replies
8. Shell Programming and Scripting
Hi, I have a large file with number of records in there. I need some help to find only first row based on a key and ignore other rows with the same key. I tried few things but file is huge(30 million rows). So need some solution that is very efficient.
e.g
Junk|Apple|7|Random|data|here...... (2 Replies)
Discussion started by: ran123
2 Replies
9. UNIX for Dummies Questions & Answers
Hi,
I have a file having content:
123
123
1234
12131
121
23
1212
1212121
23421
1212
1213123
I want to remove the repeated lines from it, i.e. I just want the any number just one time without any sorting in it.
The problem is that I am not getting result from 'uniq' command.
as... (2 Replies)
Discussion started by: nixhead
2 Replies
PCIC(4) BSD Kernel Interfaces Manual PCIC(4)
NAME
pcic -- PC Card bridge driver
SYNOPSIS
device pcic
device pccard
DESCRIPTION
The pcic driver provides support for older ISA and non-Yenta PCI PC Card bridges. The pcic driver supports most ExCA devices attached to the
ISA bus or PCI devices that do not conform to the Yenta specification.
The following ISA devices, or true clones, are supported in the current code.
Intel i82365SL Step A
Intel i82365SL Step B
Intel i82365SL Step C Intel's original 16-bit PC Card controller.
Intel i82365SL-DF Intel's last version of this device. 3.3V support was added.
VLSI 82C146 An older VLSI part with some issues on some machines.
Cirrus Logic PD-6710
Cirrus Logic PD-6720
Cirrus Logic PD-6722 Cirrus Logic's pcic controller. Compatible with the i82365SL Step C with the addition of a different 3.3V control.
Ricoh RF5C296
Ricoh RF5C396 Ricoh's PC Card bridge chips. These are compatible with the i82365SL Step C, but with yet another different 3.3V con-
trol.
Vadem 365
Vadem 465 Compatible with i82365SL Step C.
Vadem 468
Vadem 469 Like the earlier Vadem models, but with Vadem's own, incompatible, 3.3V control system.
IBM PCIC IBM clone of the original i82365SL part, with its own ID register value. Has no 3.3V ability.
Many other vendors made parts in this arena, but most of them were compatible with one of the above chipsets.
The following PCI pcmcia bridges are supported:
Cirrus Logic PD6729
Cirrus Logic PD6730
O2micro OZ6729
O2micro OZ6730
BUGS
This does not work at all at the moment.
BSD
July 9, 2002 BSD