I am using AWS CLI. I use AWS STS service for assuming role.After using that, I get temporary AWS credentials like AWS access key ID, aws secret access key and aws session token. I have created a bat file to run AWS STS assume role command and to change aws credentials file automatically. It works fine. Now after using temporary creds, I want to revert back to the original credentials file. I can change aws access key pair by running aws configure command. But i want to clear aws_session_token automatically. In linux I did it using following command.
sed '/^aws_session_token/s/=.*$/=/' credentials
sed -i -e '/aws_session_token/d' credentials
Here, I am clearing value for aws_session_token first and then the word 'aws_session_token'. I am unable to figure out how to do it in windows. So is there any sed alternative to remove value for particular key and then key itself? Any help is appreciated.