How can I remove '#' character from file
File Name: /etc/ironman.d
#dir /usr/comicon
#dir2 /usr/individuality
#dir3 /usr/land
How can I remove '#' character before dir2. There is no way to maintain line number. I tried
dirpath='#dir2 /usr/individuality'
${dirpath#/#}
But it only removes in $dirpath but not in actual file, if I use above method to remove '#' and add then, I get a duplicate of $dirpath without '#', but I just want single entry without '#' in the file. How do I remove # in place (before dir2)
You can use sed(1)
to edit files:
sed -e 's/#dir2/dir2/' /etc/ironman.d
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With