开发者

help with selecting rows using awk

I have a file as follows

  • 2.54 Ghz val
  • 2.53 Ghz val1
  • 1.6 Ghz val2
  • 800 Mhz val3
  • 2.54 Ghz val4
  • 开发者_如何学JAVA
  • 2.53 Ghz val5
  • 1.6 Ghz val6
  • 800 Mhz val7

and the pattern continues ... I want to extract all 2.54 Ghz values in one file1 and all 2.53 Ghz values in another file2 , 1.60 Ghz values in file3 and 800 Mhz values in file4

can anyone help me with this ?


 awk '{print $0 > "file_"$1"_"$2}' file


Pure Bash:

rm --force file_*

while read speed magnitude value; do
    echo -e "${value}" >> "file_${speed}_${magnitude}"
done < file
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜