[ncl-talk] deleting rows from csv file

Michael Notaro mnotaro at wisc.edu
Mon Dec 16 12:48:27 MST 2019


I have a lot of csv files with columns of day, time, and temperature
such as below.
Anytime I have consecutive rows with the same day and time,
as highlighted below, I was to only keep the last row and remove
the other duplicates.
Does anyone have any suggestions in NCL or other command line?

I did see this potential solution using sed, but it doesn't work in
my mac os environment.
https://unix.stackexchange.com/questions/265540/delete-consecutive-lines-in-csv-with-duplicate-values-in-one-field-but-keep-the

DAY    TIME   TEMP
 83.,   0.00,  -6.32
 83.,  60.00,  -6.58
 83., 120.00,  -6.80
 83., 180.00,  -7.22
 83., 240.00,  -7.10
 83., 300.00,  -7.47
 83., 360.00,  -7.69
 83., 420.00,  -7.50
 83., 480.00,  -6.75
 83., 540.00,  -5.49
 83., 600.00,  -4.54
 83., 660.00,  -3.30
 83., 720.00,  -2.42
 83., 780.00,  -1.67
 83., 840.00,  -1.64
 83., 900.00,  -2.08
 83., 960.00,  -2.99
 83.,1020.00,  -4.07
 83.,1080.00,  -5.17
 83.,1140.00,  -6.52
 83.,1200.00,  -7.60
 83.,1260.00,  -8.56
 83.,1320.00,  -8.93
 83.,1380.00,  -9.65
 84.,   0.00, -10.13
 84.,  60.00, -10.29     * want to remove
 84.,  60.00, -10.46     * want to keep
 84., 120.00, -10.72
 84., 180.00, -10.97

Thanks, Michael

Michael Notaro
Associate Director
Nelson Institute Center for Climatic Research
University of Wisconsin-Madison
Phone: (608) 261-1503
Email: mnotaro at wisc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20191216/43688cff/attachment.html>


More information about the ncl-talk mailing list