11-27-2012
Find and count unique date values in a file based on position
Hello,
I need some sort of way to extract every date contained in a file, and count how many of those dates there are.
Here are the specifics:
- The date format I'm looking for is mm/dd/yyyy
- I only need to look after line 45 in the file (that's where the data begins)
- The columns of data are seperated by indents/tabs, I need to look at the 4th column
I'll take any advice I can get, I just don't really even know where to begin aside using the cut or grep functions.
Your expertise is greatly appreciated, thanks in advance!
Jay
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
I have the following info in a file -
<Cell id="25D"/>
<Cell id="26A"/>
<Cell id="26B"/>
<Cell id="26C"/>
<Cell id="27A"/>
<Cell id="27B"/>
<Cell id="27C"/>
<Cell id="28A"/>
I would like to know how would you go about counting all... (4 Replies)
Discussion started by: Prega
4 Replies
2. UNIX for Dummies Questions & Answers
Hello,
I have two files as shown below:
test1
678
679
689
690
710
test2
1 678
654 800
676 791
689 900
I want to get a count of lines from test2 whose columns bound the values in test1
I tried running the code below; however am getting wrong results. (3 Replies)
Discussion started by: Gussifinknottle
3 Replies
3. Shell Programming and Scripting
I need to take the second column of a .csv file and count the number of instances of each unique value in that same second column. I'd like the output to be value,count sorted by most instances. Thanks for any guidance!
Data example:
317476,317756,0
816063,318861,0
313123,319091,0... (4 Replies)
Discussion started by: batcho
4 Replies
4. Shell Programming and Scripting
Hi All,
I need help for doing the following.
I have a input file like:
aaaaaaaaaabbbbbbbbbbbbbbbbbbbb
cccbbbbbaaaaaadddddaaaabbbbbbb
now I am trying to generate a output csv file where i will have for e.g.
0-3 chars of each line as the first column in the csv, 4-10 chars of the line as... (3 Replies)
Discussion started by: babom
3 Replies
5. Shell Programming and Scripting
Hi, I have tab-deliminated data similar to the following:
dot is-big 2
dot is-round 3
dot is-gray 4
cat is-big 3
hot in-summer 5
I want to count the frequency of each individual "unique" value in the 1st column. Thus, the desired output would be as follows:
dot 3
cat 1
hot 1
is... (5 Replies)
Discussion started by: owwow14
5 Replies
6. Linux
cat sample.csv
ID,Name,no
1,AAA,1
2,BBB,1
3,AAA,1
4,BBB,1
cut -d',' -f2 sample.csv | sort | uniq
this gives only the 2nd column values
Name
AAA
BBB
How to I get all the columns of CSV along with this? (1 Reply)
Discussion started by: sanvel
1 Replies
7. Shell Programming and Scripting
Looking for a little help here.
I have 1000's of text files within a multiple folders.
YYYY/
/MM
/1000's Files
Eg.
2014/01/1000 files
2014/02/1237 files
2014/03/1400 files
There are folders for each year and each month, and within each monthly folder there are... (4 Replies)
Discussion started by: whegra
4 Replies
8. UNIX for Dummies Questions & Answers
My unix version is IBM AIX Version 6.1
I tried google my requirement and found the below answer,
find . -newermt “2012-06-15 08:13" ! -newermt “2012-06-15 18:20"
But newer command is not working in AIX version 6.1 unix
I have given my requirement below:
Input:
atr files:
... (1 Reply)
Discussion started by: yuvaa27
1 Replies
9. Shell Programming and Scripting
Hello experts,
I am converting a number into its binary output as :
read n
echo "obase=2;$n" | bc
I wish to count the maximum continuous occurrences of the digit 1.
Example :
1. The binary equivalent of 5 = 101. Hence the output must be 1.
2. The binary... (3 Replies)
Discussion started by: H squared
3 Replies
10. Shell Programming and Scripting
What is an efficient way of counting the number of unique values in a 400 column by 1000 row array and outputting the counts per column, assuming the unique values in the array are:
A, B, C, D
In other words the output should look like: Value COL1 COL2 COL3
A 50 51 52... (16 Replies)
Discussion started by: Geneanalyst
16 Replies
dp(8) System Manager's Manual dp(8)
NAME
dp - parse dates RFC 822-style
SYNOPSIS
/usr/lib/mh/dp [-form file] [-format string] [-help] [-width columns] dates
OPTIONS
Overrides the default output format of dp. The output is formatted according to the instructions in the specified file. This must be a
format file; see mh-format(4). Overrides the default output format of dp. The output is formatted according to the instructions in the
specified string. This must be a format string; see mh-format(4).
The argument to the -format option must be interpreted as a single token by the shell that invokes dp. Therefore, you should usually
place the argument to this option inside double quotes ("). Prints a list of the valid options to this command. Specifies the
width of the screen in columns.
The defaults for this command are as follows:
-width defaults to the width of the terminal
DESCRIPTION
The dp command parses dates according to the ARPA Internet standard. It also understands many non-standard formats, such as those produced
by TOPS-20 sites and some UNIX sites using ctime(3). It is useful for seeing how MH will interpret a date.
The dp program treats each argument as a single date, and prints the date out in the official RFC 822 format. Hence, it is usually best to
enclose each argument in double quotes (") for the shell.
EXAMPLES
This is the default format string used by dp:
%<(nodate{text})error: %{text}%|%(pretty{text})%>
When an error is detected, this prints error: and the date that is in error. Otherwise, it outputs the proper RFC 822 format of the date.
FILES
User profile.
SEE ALSO
Commands: ap(8)
Standard for the Format of ARPA Internet Text Messages (RFC 822)
dp(8)