I am trying, utilizing the few commands I know, to extract all records within my file that were generated in November of 2007. Each record within the file has a "date" field giving the month, day, and year (9-8-88). How do I extract those records to their own file?
Once I extract those records I want to remove any records that are duplicates in another field. Please advise.
Thank you.
update: I'm leaving work in 10 minutes so hopefully someone can assist me. Thank you.
Please provide an example of the file. You could use awk to separate the month, day and year
echo 9-8-88|awk -F "-" '{print $2}'
That will print the second field separated by '-'. If you wish to print the other fields just use $1 or $3 instead. To print more than one field, "print $2,$3".
Here is a (hypothetical) example of what is in our file:
Bill Adams: ABC Contracting: 11-14-07: 6919408:314-463-2219
Bill Adams: ABC Contracting: 2-22-07: 4109663:314-463-2219
Bill Adams: ABC Contracting: 11-6-07: 6918997:314-463-2219
Steve Leitch: ERB Equipment: 11-6-07: 6918967:314-225-6403
There are thousands of records and I only want the ones from 11-07 and I only want the name and company of the contractor to be displayed once in my output.