将日志的某一部分输出为新的文件
awk '{print $7 > "access.new"}' access.log
意思为:将access.log中的第7个元素,打印出来(只保留这部分),并保存在新文件access.new中。注意单引号和双引号
awk '{print $7 " " $9 > access.new2}' access.log
意思为:将access.log中的第7和第9个元素,打印出来,并保存在新文件access.new2中。
将日志的某一部分输出为新的文件
awk '{print $7 > "access.new"}' access.log
意思为:将access.log中的第7个元素,打印出来(只保留这部分),并保存在新文件access.new中。注意单引号和双引号
awk '{print $7 " " $9 > access.new2}' access.log
意思为:将access.log中的第7和第9个元素,打印出来,并保存在新文件access.new2中。