[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Text processing help (sed?)



Hey all, not a Debian specific question. I am working with some CSV files.
Daily extracts. I was able to combine them all with cat, then yank out the
records I needed and popped then in a smaller file using grep. Finally
yanked duplicates using sort < file | uniq -d

Now comes the hard part. Each record begins with the date and hour. When I
graph a month's worth of data, the graphs get nuts, so I want to remove
specific entries from each line. Specifically, I want to replace the entry
with a comma. A sample of the file is below:
Date,TargetName ifIndex IfDescr,AvgIn,AvgOut,MaxIn,MaxOut

10/17/2003 0:00,10.2.1.101 127 10/100 utp ethernet (cat
3/5),0.12,0.04,0.18,0.05

10/17/2003 1:00,10.2.1.101 127 10/100 utp ethernet (cat
3/5),0.24,0.09,0.26,0.16

10/17/2003 2:00,10.2.1.101 127 10/100 utp ethernet (cat
3/5),0.22,0.09,0.33,0.12

10/17/2003 3:00,10.2.1.101 127 10/100 utp ethernet (cat
3/5),0.08,0.05,0.11,0.06

10/17/2003 4:00,10.2.1.101 127 10/100 utp ethernet (cat
3/5),0.16,0.05,0.23,0.08

10/17/2003 5:00,10.2.1.101 127 10/100 utp ethernet (cat
3/5),0.18,0.07,0.31,0.08

10/17/2003 6:00,10.2.1.101 127 10/100 utp ethernet (cat
3/5),0.58,0.07,0.94,0.09

10/17/2003 7:00,10.2.1.101 127 10/100 utp ethernet (cat
3/5),1.32,0.05,1.57,0.06

10/17/2003 8:00,10.2.1.101 127 10/100 utp ethernet (cat
3/5),2.11,0.03,2.76,0.04

10/17/2003 9:00,10.2.1.101 127 10/100 utp ethernet (cat
3/5),2.44,0.05,3.36,0.05

10/17/2003 10:00,10.2.1.101 127 10/100 utp ethernet (cat
3/5),2.15,0.03,2.4,0.04

10/17/2003 11:00,10.2.1.101 127 10/100 utp ethernet (cat
3/5),1.97,0.04,2.07,0.04

10/17/2003 12:00,10.2.1.101 127 10/100 utp ethernet (cat
3/5),1.73,0.04,2.02,0.04

10/17/2003 13:00,10.2.1.101 127 10/100 utp ethernet (cat
3/5),2.09,0.05,2.88,0.08

10/17/2003 14:00,10.2.1.101 127 10/100 utp ethernet (cat
3/5),2.03,0.04,2.69,0.05

10/17/2003 15:00,10.2.1.101 127 10/100 utp ethernet (cat
3/5),1.53,0.04,1.72,0.04

10/17/2003 16:00,10.2.1.101 127 10/100 utp ethernet (cat
3/5),2.64,0.04,3.98,0.06

10/17/2003 17:00,10.2.1.101 127 10/100 utp ethernet (cat
3/5),2.04,0.06,2.69,0.07

10/17/2003 18:00,10.2.1.101 127 10/100 utp ethernet (cat
3/5),0.82,0.12,1.16,0.22

10/17/2003 19:00,10.2.1.101 127 10/100 utp ethernet (cat
3/5),0.2,0.05,0.28,0.08

10/17/2003 20:00,10.2.1.101 127 10/100 utp ethernet (cat
3/5),0.03,0.03,0.06,0.03

10/17/2003 21:00,10.2.1.101 127 10/100 utp ethernet (cat
3/5),0.07,0.47,0.08,0.75

10/17/2003 22:00,10.2.1.101 127 10/100 utp ethernet (cat
3/5),0.05,0.03,0.08,0.05

10/17/2003 23:00,10.2.1.101 127 10/100 utp ethernet (cat
3/5),0.03,0.03,0.05,0.05



How would I replace 10/17/2003 1:00 with a , ?   I need to hit each day of
the month, and I only want to show the text for 10/**/2003 0:00, 8:00,
16:00. The rest I want to use a , to show an empty cell.







Reply to: