Hi all,
The awk statement below nearly works as I want it to. That is it removes :: if it is on the end or beginning of the PATH variable, but :: anywhere else is not removed - however ::: is. So it is nearly there. Any awk experts able to shed light light on getting the :: removed rather than the ::: as it does now?
awk ' {
if(match($0,"^[\t ]*(set)*[\t ]*PATH[\t ]*=") != 0){
gsub("PATH[\t ]*=[\t ]*\\::","PATH=");
gsub("PATH[\t ]*=[\t ]*\"\\::","PATH=");
gsub(":\\::",":");
gsub(":\\:\"$","");
gsub(":\\:$","");
print $0;
}
else {
print $0;
}
}' ${1} > ${1}.work
mv ${1}.work ${1}
The awk statement below nearly works as I want it to. That is it removes :: if it is on the end or beginning of the PATH variable, but :: anywhere else is not removed - however ::: is. So it is nearly there. Any awk experts able to shed light light on getting the :: removed rather than the ::: as it does now?
awk ' {
if(match($0,"^[\t ]*(set)*[\t ]*PATH[\t ]*=") != 0){
gsub("PATH[\t ]*=[\t ]*\\::","PATH=");
gsub("PATH[\t ]*=[\t ]*\"\\::","PATH=");
gsub(":\\::",":");
gsub(":\\:\"$","");
gsub(":\\:$","");
print $0;
}
else {
print $0;
}
}' ${1} > ${1}.work
mv ${1}.work ${1}