Thank you for your comments. I'm sorry for that, the error I get is:
[main_samview] fail to read the header from "input.bam".
[main_samview] fail to read the header from "-".
I've tried rpolicastro 's suggestion and it actually works when I run the command and only print head, like:
samtools view -h input.bam | sed -r 's/[A-Za-z0-9\-]+__//g' | head
I get
@HD VN:1.6 SO:coordinate
@SQ SN:chr19 LN:2134
But then, I tried to save it as a bam: samtools view -h input.bam | sed -r 's/[A-Za-z0-9\-]+__//g' | samtools view -Shb - > output.bam, and it says there're duplicates sequences "chr[1-9XYM]" and "samtools view: failed to add PG line to the header"
Bam File: Change Chromosome Notation
BAM File, Change chromosome notation