- Oct 11, 2000
- 16,843
- 2
- 0
How do I find a string within a file say loadRuleLatest and check if it has a # at the start and if it does, can it take out the # and leave the line as is? That can be one script
And also the reverse?
How can I check that if it it finds loadRuleLatest and then takes out # at the start of the line if it is present?
Currently I we have to manually edit the pair of config files and there are 8 pairs of files. This would speed up the progress dramatically for me!
I can use the SED command but not sure how to get it to replace at the start of the file
e.g
Finds:
#/server/box1/algo/loadRuleLatest pathA/ruleAAB
changed to
/server/box1/algo/loadRuleLatest pathA/ruleAAB
Finds
/server/box1/algo/loadRuleLatest pathA/ruleAAB
#/server/box1/algo/loadRuleLatest pathA/ruleAAB
Every occurrence in file: :%s/OLD/NEW/g
I've used SED but ion this case the path after /box1 is different
Cheers guys. I've been searching online how to do it but need more help (n00b). Cheers!
Koing
And also the reverse?
How can I check that if it it finds loadRuleLatest and then takes out # at the start of the line if it is present?
Currently I we have to manually edit the pair of config files and there are 8 pairs of files. This would speed up the progress dramatically for me!
I can use the SED command but not sure how to get it to replace at the start of the file
e.g
Finds:
#/server/box1/algo/loadRuleLatest pathA/ruleAAB
changed to
/server/box1/algo/loadRuleLatest pathA/ruleAAB
Finds
/server/box1/algo/loadRuleLatest pathA/ruleAAB
#/server/box1/algo/loadRuleLatest pathA/ruleAAB
Every occurrence in file: :%s/OLD/NEW/g
I've used SED but ion this case the path after /box1 is different
Cheers guys. I've been searching online how to do it but need more help (n00b). Cheers!
Koing