Do I really need to do all this just to get one item per line $ basex -s format=no -q 'doc("...")//.../*:name/concat(text(),"
")' AM 594 復興1 AM 612 中央 AM 630 台灣 AM 657 正聲 I use -s format=no to turn off spaces. -s format=text not much help. There really ought to be a -s option to say I want newlines instead of spaces. In perl all we need is perl -l. OK, maybe Windows users also need CRLFs (\r\n).