So I have a sam file with extended CIGAR format like this:

    17H87=1D12=1D2=3D32=1D4=2D5=2D13=....

And I want to convert it to a sam file containing regular CIGAR format that will look like this:

    17S83M1D14M1D4M3D31M1D2M2D6M...

 (they do not represent the same reads... I want only to visualize the problem)

Anyone knows some software/script that will convert sam/bam with extended CIGAR to a sam/bam with regular CIGAR?
It seems like a standard problem that might already have a solution so I want to ask here before solving it the hard way(coding)
`reformat.sh` from [BBMap suite][1] can do this: `reformat.sh in=orig.sam out=new.sam sam=1.3`


  [1]: https://sourceforge.net/projects/bbmap/