Hi all,
I have a quick question:
I have a 4 column tab-separated file.
I want to count the number of times each unique value in column 2 appears and add that number in a 5th column.
I have the following input file:
and the following is the desired output
How can I combine sort and grep for the desired output?
Thank you.
I just realized that your script counts all of the unique instances in Column 2.
However, I need to count the number of different items in Column 4 that a value in Column 2 occurs with in --- in this case, real frequency does not matter.
I will provide more sample files, in case my question was not clear:
For instance this input file:
should yield this output file:
Where "below-steal-n" acutally occurs 4 times --- yet with 3 different items in Column 4 --- thus, in Column 5 its result is 3.
Last edited by owwow14; 10-31-2013 at 02:08 PM..
Reason: FIXED ERROR
Not sure if your sample output is correct based on your description: the 'between-part-of-variance-n' fields are not counted correctly.
Pls validate/clarify
I have an xml file dumped from rrd file, that I want to "patch" so the xml file doesn't contain any blank hole in the resulting graph of the rrd file.
Here is the file.
<!-- 2015-10-12 14:00:00 WIB / 1444633200 --> <row><v> 4.0419731265e+07 </v><v> 4.5045912770e+06... (2 Replies)
I'm pretty new to scripting and didn't see an example of this issue yet. I am trying to count and print the total number of times each value is found within a file. Here is a short example of my starting file.
value 3
value 3
value 3
value 3
value 4
value 6
value 6
value 6
value 6... (3 Replies)
Hi,
I need a shell script which can provide details from error logs like this
Aug 23 21:19:41 red mountd: authenticated mount request from bl0110.bang.m
pc.local:651 for /disk1/jobs (/disk1)
Aug 23 08:49:52 red dhcpd: DHCPDISCOVER from 00:25:90:2b:cd:7c via eth0: unknown client
Aug 24... (2 Replies)
Dear UNIX community,
I would like to to count characters from a specific row and have them displayed line-by-line.
I have a file called testAwk2.csv which contain the following data:
rabbit penguin goat
giraffe emu ostrich I would like to count in the middle row individually... (4 Replies)
Hello all
siteexplorer.search.yahoo.com can output results in tsv format, when opened in excel I get 4 columns.
I would like to wget that file, which I can do. I would then like to pull the 2nd column and output it only.
I've searched around and found a few bits and pieces but nothing I've... (6 Replies)
Hi,
I've been trying to create a perl file to run something very specific. But I'm not getting any success. I'm not very good with hashing.
I have a file with two columns (tab separated) (already sorted)
99890 +
100281 +
104919 -
109672 +
113428 -
114501 +
115357 +
115598 ... (7 Replies)
Hi,
Can someone help me count this line:
Say I have a file (file1.txt) that contains below:
11/16 13:08:19.5436 18096 --- Generating a <reading> event
11/16 13:08:19.7784 18096 ---- Sending a <writing> event
11/16 13:08:37.4516 18096 --- Generating a <reading> event
11/16... (1 Reply)
Hi,
I need to count the number of occurences of the character " in a file that contains huge number of records.
What command could I use?
Please specify in detail since I am new :|
Thanks much. (3 Replies)