Can someone help me out with this. I have 2 files
First one contains IDs of employees that left a company
employeeid.txt
5678D956
45S87954
56898K78
4D856898
556987F8
23657D87
Second file is a config file for an application that stores users settings
App.conf
(only part of the file)
/export/home/conf[naa.5678D956]/displayName = "John Paul (naa.5678D956)"
/export/home/conf[naa.5678D956]/Scripts = "true"
/export/home/conf[naa.5678D956]/FTP = "true"
/export/home/conf[naa.5678D956]/HomeDirs = "true"
/export/home/conf[naa.4487984D]/displayName = "Cara Jones (naa.4487984D)"
/export/home/conf[naa.4487984D]/Scripts = "false"
/export/home/conf[naa.4487984D]/FTP = "true"
/export/home/conf[naa.4487984D]/HomeDirs = "true"
/export/home/conf[naa.45S87954]/displayName = "Eimer Fenton (naa.45S87954)"
/export/home/conf[naa.45S87954]/Scripts = "true"
/export/home/conf[naa.45S87954]/FTP
/export/home/conf[naa.45S87954]/HomeDirs = "true"
/export/home/conf[naa.56898K78]/displayName = "Edd Waters (naa.56898K78)"
/export/home/conf[naa.56898K78]/Scripts = "true"
/export/home/conf[naa.56898K78]/FTP = "true"
/export/home/conf[naa.56898K78]/HomeDirs = "true"
/export/home/conf[naa.909878S4]/displayName = "Phil Mooney (naa.909878S4)"
/export/home/conf[naa.909878S4]/Scripts
/export/home/conf[naa.909878S4]/FTP = "true"
/export/home/conf[naa.909878S4]/HomeDirs = "true"
I would like to have it so that if a employee ID exists in employeeid.txt
, it comments out their configuration setting in App.conf
and saves as new file
#/export/home/conf[naa.5678D956]/displayName = "John Paul (naa.5678D956)"
#/export/home/conf[naa.5678D956]/Scripts = "true"
#/export/home/conf[naa.5678D956]/FTP = "true"
#/export/home/conf[naa.5678D956]/HomeDirs = "true"
/export/home/conf[naa.4487984D]/displayName = "Cara Jones (naa.4487984D)"
/export/home/conf[naa.4487984D]/Scripts = "false"
/export/home/conf[naa.4487984D]/FTP = "true"
/export/home/conf[naa.4487984D]/HomeDirs = "true"
#/export/home/conf[naa.45S87954]/displayName = "Eimer Fenton (naa.45S87954)"
#/export/home/conf[naa.45S87954]/Scripts = "true"
#/export/home/conf[naa.45S87954]/FTP
#/export/home/conf[naa.45S87954]/HomeDirs = "true"
#/export/home/conf[naa.56898K78]/displayName = "Edd Waters (naa.56898K78)"
#/export/home/conf[naa.56898K78]/Scripts = "true"
#/export/home/conf[naa.56898K78]/FTP = "true"
#/export/home/conf[naa.56898K78]/HomeDirs = "true"
/export/home/conf[naa.909878S4]/displayName = "Phil Mooney (naa.909878S4)"
/export/home/conf[naa.909878S4]/Scripts
/export/home/conf[naa.909878S4]/FTP = "true"
/export/home/conf[naa.909878S4]/HomeDirs = "true"
I have been trying to get it to work with sed, but have not been getting anywhere