#!/bin/sh

R1=/[[:digit:]]\+/
R2=/[[:alpha:]]\+/
echo $R1
echo $R2
echo $1

gsed -n -e "{                    \
:B                              \
$R2q 1                         \
 h                              \  #first line is stored in hold
:A                              \
 n                              \ #read in next line. Two possibilities:
$R1{x;p;b A}                   \   #[1] ordinary line
$R2{H;g;s/\n//g;p;s/.*//;x;d}  \   #[2] special line
}"  $1
