MIN MAX for GREP?

C

Chris Doe

I have a large .CSV file with 10 fields on each line. The first field
is a EPOCH date which is the only field I am interested in.

My dilemma: Based on a START and END date provided from the user, I
need to be able to PIPE all lines within that CSV file to a temporary
file which start with an EPOCH date ( >= START date and <=END date )

I have been trying something along the lines of

grep "^\{$min, $max\}" file.csv > temp.csv but no luck... Any ideas

Regards
Chris
 
T

Tad McClellan

Chris Doe said:
Subject: MIN MAX for GREP?


There is no need to shout at us.

I have a large .CSV file with 10 fields on each line. The first field
is a EPOCH date which is the only field I am interested in.

My dilemma: Based on a START and END date provided from the user, I
need to be able to PIPE all lines within that CSV file to a temporary
file


That cannot be done.

A pipe connects two _programs_.

You simply want to _write_ it to a file, I expect.

which start with an EPOCH date ( >= START date and <=END date )

I have been trying something along the lines of

grep "^\{$min, $max\}" file.csv > temp.csv but no luck... Any ideas


That is not Perl, that is grep(1).

Please ask Perl questions in the Perl newsgroup, ask questions about
OS-specific tools in the appropriate OS-specific newsgroup.


Here is how you can do it with Perl:

# untested
while ( <CSV> ) {
# get fields into @record somehow (hint: use a module)
print OUT if $record[0] >= $start and $record[0] <= $end;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,187
Latest member
RosaDemko

Latest Threads

Top