There is a
-B flag in
Length of barcode starting from the 5’-end. When INT is positive, the barcode of each read will be trimmed before mapping and will be written at the BC SAM tag. For paired-end reads, the barcode from both ends are concatenated. 
However, it does not seem to be present in
bwa mem. Is there a way to replicate this behavior in
bwa mem? It doesn't actually affect the actual alignment (as far as I can tell), so technically it should be possible for both alignment options.
Also, are there other aligners that support this behavior?