Skip to main content
don't expand backslashes, and keep leading and trailing whitespace (not a problem here but a good habit to get into)
Source Link
Gilles 'SO- stop being evil'
  • 866.6k
  • 205
  • 1.8k
  • 2.3k
mysql --format csv --skip-column-names \
    -e "select xmldata from mytable limit 1;" \
    | while IFS= read -r line; do xmllint --format - <<<$line;<<<"$line"; done

Split for easier reading, obviously you don't need to. The <<<$line is a herestring, which feeds the contents of $line to xmllint as stdin.

mysql --format csv --skip-column-names \
    -e "select xmldata from mytable limit 1;" \
    | while read line; do xmllint --format - <<<$line; done

Split for easier reading, obviously you don't need to. The <<<$line is a herestring, which feeds the contents of $line to xmllint as stdin.

mysql --format csv --skip-column-names \
    -e "select xmldata from mytable limit 1;" \
    | while IFS= read -r line; do xmllint --format - <<<"$line"; done

Split for easier reading, obviously you don't need to. The <<<$line is a herestring, which feeds the contents of $line to xmllint as stdin.

Source Link
Kevin
  • 41.8k
  • 17
  • 91
  • 113

mysql --format csv --skip-column-names \
    -e "select xmldata from mytable limit 1;" \
    | while read line; do xmllint --format - <<<$line; done

Split for easier reading, obviously you don't need to. The <<<$line is a herestring, which feeds the contents of $line to xmllint as stdin.