我的记录中有这样的文本文件
BOOK|100004
TRAN|A
ANAM|Alberta
TNAM|The School Act; the School Assessment Act. The Tax Recovery Act. The School Grants Act. The School Attendance Act and General Regulations of the Department of Education
PBLS|King's Printer
SUB1|Alberta, Canada, Canadian Prairies, NOISBN
我需要创建一个具有这种格式的 xml 文件,
<BOOK>100004</BOOK>
<TRAN>A</TRAN>
<first 4 chars> text data </ first 4 chars again>
我想我几乎可以使用这样的 sed 命令,
$sed 's#([:alpha:]\{4\})\|(*)#\<\1\>\2<\/\1\>#g'
除了我得到这个错误:sed: -e expression #1, char 41: invalid reference \1 on
-s'命令的RHS`
任何 sed 专家都想把我推上一条开明的道路吗?