题解 | #业务分析-提取值#
业务分析-提取值
https://www.nowcoder.com/practice/f144e52a3e054426a4d265ff38399748
#! /bin/bash cat nowcoder.txt | awk -F '[:]' '{if(NR==1){printf("serverVersion:%s\n",$NF)}}' cat nowcoder.txt | awk -F '[:]' '{if(NR==3){printf("serverName:%s\n",$NF)}}' cat nowcoder.txt | awk -F '[:,]' '{if(NR==4){printf("osName:%s\nosVersion:%s\n",$(NF-2),$NF)}}'