File: x.awk

package info (click to toggle)
icom 20040912-1.1
  • links: PTS
  • area: main
  • in suites: squeeze, wheezy
  • size: 744 kB
  • ctags: 501
  • sloc: ansic: 3,086; csh: 65; makefile: 62; awk: 61
file content (26 lines) | stat: -rw-r--r-- 481 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#! /bin/awk
BEGIN {
	printf("%s", "[REV]\nID=1.0.0\nAPP=IC-PCR1000  Revision 2.0\n")
	bank = 0
	chan = 0
}
{
	if (NF < 4 && $1 == "bank") {
		printf("[BANK%02d]\n", bank)
		printf("BANKNAME=%s\n", $3)
		printf("ACTIVECH=0\n")
		bank++
		chan = 0
	}
	if (NF == 4) {

		printf("%02d=%s,,%.3f,%s,3k,OFF,3kHz,OFF,OFF,OFF\n", chan, $4, $1 / 1000, $2)
		chan++;
	}
} END {
	for (; bank < 20; bank++) {
		printf("[BANK%02d]\n", bank)
		printf("BANKNAME=\n")
		printf("ACTIVECH=0\n")
	}
}