Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用bash将文本文件输出转换为html格式_Bash_Awk - Fatal编程技术网

使用bash将文本文件输出转换为html格式

使用bash将文本文件输出转换为html格式,bash,awk,Bash,Awk,您好,我正在尝试将文本文件转换为html with table,以便以表格格式发送输出,我使用了awk'BEGIN{print”内容类型:text/html;charset=“us ascii”“\n”“\n”“\n”“}{print”“;for(i=1;i您需要清理行。\n需要使用双引号,如下所示: awk ' BEGIN{ print "Content-Type: text/html; charset=us-ascii\n <html>\n <Body>\n&

您好,我正在尝试将文本文件转换为html with table,以便以表格格式发送输出,我使用了
awk'BEGIN{print”内容类型:text/html;charset=“us ascii”“\n”“\n”“\n”“}{print”“;for(i=1;i您需要清理行。
\n
需要使用双引号,如下所示:

awk '
BEGIN{
    print "Content-Type: text/html; charset=us-ascii\n <html>\n <Body>\n<table>"
    } 
    {print "<tr>"
    for(i=1;i<=NF;i++)
        print "<td>" $i"</td>"
    print "</tr>"
    }
END{
    print "\n</Body>\n</html>\n</table>"
    }' a.txt >> email.html
awk'
开始{
打印“内容类型:text/html;字符集=us ascii\n\n\n”
} 
{打印“”

对于(i=1;i-Edited-,它可用于:

awk '
BEGIN{
    print "Content-Type: text/html; charset="us-ascii"\n<html>\n<head>\n<style>\ntable                 ,   th,td\n{\n border:1px solid black;
    border-collapse:collapse;\n}\n</style>\n</head>\n<Body>\n<table>"
    } 
    {print "<tr>"
    for(i=1;i<=NF;i++)
        print "<td>" $i"</td>"
    print "</tr>"
    }
    END{
    print "\n</table>\n</Body>\n</html>\n" 
    }' a.txt >> email.html
awk'
开始{
打印“内容类型:text/html;charset=“us ascii”\n\n\n表格,th,td\n{\n边框:1px纯黑色;
边框折叠:折叠;\n}\n\n\n\n“
} 
{打印“”

对于(i=1;iCool..but
cat email.html | sendmail-ttmp@exmple.com
不工作,我无法通过表格接收输出