3 ms·
Produces (a) original 084.l and (b) original shell script for testing yy084 ("0x"). set -x # requirements: tnftp, ed, sed, tr _fmt() { x=$
by 1vuio0pswjnm7 2y ago
Produces (a) original 084.l and (b) original shell script for testing yy084 ("0x").
set -x
# requirements: tnftp, ed, sed, tr
_fmt()
{
x=$(echo x|tr x '\34'); y=$(echo x|tr x '\35');
sed "s/<code>/$x/g; s/<\/code>/$y/g;
s/'/'/g; s///\//g;
s/&/\&/g; s/"/\"/g;
s/</</g; s/>/>/g" \
|tr '\34\35' '\n\n' \
|sed 's/ */ /'
}
x=https://news.ycombinator.com/item?id=40894851
tnftp -4o/dev/stdout $x|_fmt > 1.htm
# delete html
sed -i '
1,15d; 114,196d; 207,218d; 264,275d; 351,362d;
454,465d; 520,531d; 638,649d; 751,762d; 865,876d;
978,989d; 1111,1122d; 1225,1236d; 1382,1393d;
1538,1549d; 1680,1691d; 1822,1833d; 1962,1973d;
2100,2111d; 2217,2228d; 2330,2342d;
' 1.htm
z=$(sed -n '$!d;=' 1.htm)
test $z -eq 2015||sed -i '2016,$d' 1.htm
# move
echo "
320,373m66
163,373m126
784,2015m126
1606,2015m1602
w
q
"|ed 1.htm
# indent
sed -i '/^ \^HTTP/s/ *//;
/^ TWVGH/s/ *//;
/^ %/s/ *//;
/^ <MODE/s/ *//' 1.htm
# fix: html encoding in pattern - sed.gov
sed -i '621s/\"/\"/2' 1.htm
sed -n 1,1595p 1.htm > 084.l
sed -n 1596,2016p 1.htm > 0x
# flex -8Cem 084.l
# cc -O3 -std=c89 -W -Wall -pipe lex.yy.c -static -s -o yy084