hello,
what I have:
---
lots of text bla bla bla
PATCH MANAGEMENT AND SOFTWARE UPDATES - EXTERNAL
Risk Severity: High Area: External Network Relative Rating: Medium
lots of text bla bla bla
WIRELESS AP
Risk Severity: High Area: External Network Relative Rating: Poor
lots of text bla bla bla
IT DOCUMENTATION
Risk Severity: High Area: Administrative Relative Rating: High
lots of text bla bla bla
and so on and so on...
---
what I need to do is convert all "medium", "low" or "high" to numeric values for risk severity and calculate averages:
High - 5
Medium - 3
Low - 1
For relative rating:
Inadequate - 1
Poor - 2
Medium - 3
High - 4
Excellent - 5
there are 4 areas (internal, external, physical and administrative),
so at the end it should be grouped by areas and look like:
--
PATCH MANAGEMENT AND SOFTWARE UPDATES - EXTERNAL:Risk Severity:5:Area:External Network: Relative Rating:4
WIRELESS AP:Risk Severity:5:Area:External Network: Relative Rating:2
External Network Averages:Risk Severity:5:Relative Rating:3
IT DOCUMENTATION:Risk Severity:5:Area:Administrative:Relative Rating:4
..
..
..
Administrative Area Averages:Risk Severity:3.2:Relative Rating:3.6
---
So far what I have is:
#BEGIN {
# print "Title:Risk_Severity:Risk_Severity_Value:Area:Area_Value:Relative_Rating:Relative_Rating_Value"
#}
# selecting titles with ratings
/Risk Severity/ { for (i=(NR-1); i<NR; i++) { print b[i%3] }; print} { b[NR%3]=$0 }
#
# getline
# Replace the special character for a hypen with a hypen
# gsub("\226","-")
# title = $0
if (NR % 2 == 1) then
getline
title = $0
else
getline
split(....
---
May somebody guide me on what to do next, I installed awk yesterday
