cat、sed、写入多行文件

cat > /tmp/file.txt <<-EOF
1111111111111
2222222222222
3333333333333
abc
EOF

V00='#================================================='
#Z00='#                          '$(date "+%F %T")'                          '
Y01='    location ~ /data/db/dir/'$URL'/test(.*)$ {'
Y02='         allow 1.1.1.0/19;'
Y03='         allow 2.2.2.2/29;'
Y04='         allow 3.3.3.0/21;'
Y05='         allow 8.8.8.8/32;'
Y06='         deny all;'
Y07='         if ( $http_destination ~* ^https(.*)$ ) {'
Y08='             set $fixed_destination http$1;'
Y09='         }'
Y10='         proxy_next_upstream http_502 http_504 error timeout invalid_header;'
Y11='         proxy_pass_header Set-Cookie;'
Y12='         session_sticky_hide_cookie upstream=publish_default;'
Y13='         proxy_pass http://publish_default;'
Y14='    }'

sed -i "/#Payment Tag/a$V00\n\n$Y01\n$Y02\n$Y03\n$Y04\n$Y05\n$Y06\n\n$Y07\n$Y08\n$Y09\n\n$Y10\n$Y11\n$Y12\n$Y13\n\n$Y14\n" /tmp/file.txt

--