Hi All,
I am fairly new to the world of Unix, and I am looking for a way to replace a line of text in a file with a delimited array of values.
I have an aliases file that is currently in use on our mail server that we are migrating off of. Until the migration is complete, the server must stay up. I need to migrate approximately 50 people per day. In order to do this, I must replace lines in my aliases file without disturbing the distribution lists.
For example, I have a list of users as such:
user1: id1
user2: id2
user3: id3
user4: user2
distributionlist: user1,user3
I want to search that file based on the id# and comment that line out. I then want to insert a line directly underneath it as such:
#user1: id1
user1:
alias1@domain.com
The domain is not static, and that is why I would need to reference an array (tab delimited or such).
I would prefer to create a backup of the original file with a rather than output to a new filename as I think this may be easier than changing the script that puts the file into production.
I know this probably isn't the best explanation and I may be missing some info. Thanks in advance!