# # Abs: get_val.awk is an awk program to get the extant values of all EPICS # PVs that are in a given machine model and match the given patterns # for primary and attribute. # # Usage: # # aidaget modelTwiss//Design. | \ # awk -v patt= -v attr= -f get_val.awk # # For instance the following gets the BDES of all XCORs in the Full Machine. # # Eg aidaget modelTwiss//Design.FullMachine | awk -v patt=XCOR -v attr=BDES -f get_val.awk # # get_val.awk is not intended to be used directly by a user. Use valz or # plotz instead. # # Ret: Prints the PV name, Z value, and extant Channel Access value, of # each matched PV, one row per PV, on stdout. # # Auth: Greg White, 6-Jul-2010 # # --------------------------------------------------------------------- # Mods: # ===================================================================== /BEGIN/ { dev_name = $3 z=$4 if ( match(dev_name,patt)) { pvname = dev_name ":" attr; inst=sprintf("caget %s",pvname); { inst | getline res; } close(inst); if (res != "") { split(res,a); a[1]=""; printf("%s %s",pvname,z); for (i in a) {printf(" %s",a[i]);} printf("\n"); } } }