# by Artyom Bologov
H
,p
# Add a vertical bar to separate the template and value
2s/^/|/
,j
# Replace and print
s/X\(.*\)|\(.*\)/\2\1/p
Q