#! /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)}}'