If you would like to remove the specific character or replacing string in the particular file by the command.
My string is "TTthelinuxXX" and change to be "**thelinux**"
Use the below command to view the output, if you want to update permanently in file execute with "-i" option
$ sed -r 's/[TX]+/*/g' filename.txt
$ sed -r -i 's/[TX]+/*/g' filename.txt
Another one is found and remove all a-z lower case character from particular file,
$ sed -r 's/[a-z]//g' filename.txt
Another one is found and remove all A-Z uppercase character from particular file,
$ sed -r 's/[A-Z]//g' filename.txt.
have any blank lines can remove that part
sed '/^\s*$/d'
$ sed '/^$/d' filename_in.txt
$ grep -v '^$' filename_in.txt
Comments (0)