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

Re: Text processing help (sed?)



Hi Bruce,

awk is a quite powerful tool for that sort of thing.

Its basic structure is 
/pattern/ {action}
i. e. it reads a line from the input file and if the line matches /pattern/ it
does {action} (e. g. write the line to output or write "," instead).

It is described very well in the manpage.


On Thu, Nov 13, 2003 at 04:03:58PM -0500, BruceG wrote:
> 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
> 

HTH
-- 
Joachim Fahnenmüller

# Hi! I'm a .signature virus. Copy me into
# your ~/.signature to help me spread!



Reply to: