Raw Input
The characteristics of the input data:
  • Each line consists of two fields, separated by a pipe '|', where
  • the first field is a comma-separated list of items, and
  • the second field is a tag.
For example:
100,210,354,462|acct
331,746,50|mis
90,263,47,14|sales
Desired Output
Now we want to list one item per line, with tag appended:
100acct
210acct
354acct
462acct
331mis
746mis
50mis
90sales
263sales
47sales
14sales
Script and Comments
Script1
[ 1] :loop
[ 2] s/,\(.*|\)\(.*\)/\2\n\1\2/
[ 3] t loop
[ 4] s/|//