I have the following file.txt that follows the same pattern and I want to modify it where this file is by adding an ip:
# gfhfhgfh
gfhfghgfhgfhgfh
MACs
# access
USER CONSOLA *,!10.249.247.3,!10.249.245.65
/bin/false
I want to add an ip in the end of the line that contains as patron USER CONSOLE:
USER CONSOLA *,!10.249.247.4,!10.249.245.65,!10.249.245.90,
I only manage to add the ip in the whole document at the moment but not in that particular line the code used is
sed 's/\r\?$/,!10.10.11.1/' file.txt