Heres one in sed that changes commas to bars:
# sed script to convert case (d) to bar-delimited records
s/^ *\(.*[^ ]\) *$/|\1|/;
s/" *, */"|/g;
s/| *\([^",|][^,|]*\) *, */|\1|/g;
s/| *, */|\1|/g;
#---end of script---
awk is even easier and quicker..heres no commans but spaces instead
awk -F"," -f file.csv file.txt
There is a problem with line 5 of your sed script. You're missing \(...\). Also, this script won't work if your CSV records contain embedded '|' characters. It will not quote those fields on output.
isnt a bar an invalid character inside LMS ? :)
Good catch on the missing bit... I whipped it off in a few seconds while you were ansswering ahead of me.
my problem is exporting devices and some fields contains comma that is also used as field separator. So best soulution would be to make cw at source not to use comma. It is better then using replacement afterwords
The fields that contain commas should be quoted. My Perl script handles this as well as producing tab-delimited output with fields that contain embedded tabs quoted. All modern CSV parsers should be able to handle quoted fields.
If you are finding fields in LMS exports that contain commas are NOT quoted, please let me know. I have fixed all of the instances I have found so far.
Just create a custom report template and choose these Template rules:
System Name: equals :all
And: Updated At:=: all
And: System: Contact: equals: all
And: Chassis Serial Number: equals : all
And: Processor:Ram Size (MB):=: all
And: Processor: NVram Size:=: all
And: Processor NVram Used (kb)=: all
And: Flash Device: Flash Device Size (MB):=: all
Thats all the columns that exist in the original canned report.
Or if you feel adventerious, just use awk on an exported csv of the summary report and drop $3