История изменений
Исправление crutch_master, (текущая версия) :
Не слушай их. Бери html-xml-utils. Он может частично пережевывать кривой html, но лучше его править перед скармливанием, конечно.
Там sed может быть и не нужен, надо смотреть на твои не нужные атрибуты. Ид для дива поставил div_id.
$ cat test.html | hxnormalize -x | tee >(hxselect -c ".MessageItemText" >> test.txt) >(hxselect "#div_id div div" | head -n1 | sed "s/.*\\$/\\$/;s/\s.*//;s/\\$/ \\$/" | tr --delete '\n' >> test.txt) >(hxselect -c ".TimeHandler" >> test.txt) >(echo >> test.txt) > /dev/null
$ cat test.txt
$ВРЕМЯ_СООБЩЕНИЯ $ИСТОЧНИК $ТЕКСТ_СООБЩЕНИЯ
Исправление crutch_master, :
Не слушай их. Бери html-xml-utils
Там sed может быть и не нужен, надо смотреть на твои не нужные атрибуты. Ид для дива поставил div_id.
$ cat test.html | hxnormalize -x | tee >(hxselect -c ".MessageItemText" >> test.txt) >(hxselect "#div_id div div" | head -n1 | sed "s/.*\\$/\\$/;s/\s.*//;s/\\$/ \\$/" | tr --delete '\n' >> test.txt) >(hxselect -c ".TimeHandler" >> test.txt) >(echo >> test.txt) > /dev/null
$ cat test.txt
$ВРЕМЯ_СООБЩЕНИЯ $ИСТОЧНИК $ТЕКСТ_СООБЩЕНИЯ
Исходная версия crutch_master, :
html-xml-utils
Там sed может быть и не нужен, надо смотреть на твои не нужные атрибуты. Ид для дива поставил div_id.
$ cat test.html | hxnormalize -x | tee >(hxselect -c ".MessageItemText" >> test.txt) >(hxselect "#div_id div div" | head -n1 | sed "s/.*\\$/\\$/;s/\s.*//;s/\\$/ \\$/" | tr --delete '\n' >> test.txt) >(hxselect -c ".TimeHandler" >> test.txt) >(echo >> test.txt) > /dev/null
$ cat test.txt
$ВРЕМЯ_СООБЩЕНИЯ $ИСТОЧНИК $ТЕКСТ_СООБЩЕНИЯ