Sharat Chandra
Sharat Chandra

Reputation: 4544

help with selecting rows using awk

I have a file as follows

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 ?

Upvotes: 1

Views: 369

Answers (2)

Fritz G. Mehner
Fritz G. Mehner

Reputation: 17188

Pure Bash:

rm --force file_*

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

Upvotes: 0

ghostdog74
ghostdog74

Reputation: 342363

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

Upvotes: 8

Related Questions