hello-serv.awk

来自「gawk: linux下资料处理工具」· AWK 代码 · 共 15 行

AWK
15
字号
BEGIN {  RS = ORS = "\r\n"  HttpService = "/inet/tcp/8080/0/0"  Hello = "<HTML><HEAD>" \          "<TITLE>A Famous Greeting</TITLE></HEAD>" \          "<BODY><H1>Hello, world</H1></BODY></HTML>"  Len = length(Hello) + length(ORS)  print "HTTP/1.0 200 OK"          |& HttpService  print "Content-Length: " Len ORS |& HttpService  print Hello                      |& HttpService  while ((HttpService |& getline) > 0)     continue;  close(HttpService)}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?