I have peiced together most of what I could, but am stuck trying to find a
way to grab particular fields that I need from two files, then output to a
final file.
I have a multiple files called antenna# that looks like:
RXOTX-11-0 B00227A ALL GSM1900 BETAA 45
RXOTX-11-1 B00227A ALL GSM1900 BETAA 45
RXOTX-11-2 B00227A ALL GSM1900 BETAA 45
RXOTX-11-4 B00227B ALL GSM1900 BETAB 43
RXOTX-11-5 B00227B ALL GSM1900 BETAB 46
RXOTX-11-6 B00227B ALL GSM1900 BETAB 43
RXOTX-11-8 B00227C ALL GSM1900 BETAC 44
RXOTX-11-10 B00227C ALL GSM1900 BETAC 46
I have the same amount of files called build# that looks like:
RXMOI:MO=RXOTX-152-0,BAND=GSM1900,MPWR=POWER,ANT=ZERO_ALPHA;
RXMOI:MO=RXOTX-152-1,BAND=GSM1900,MPWR=POWER,ANT=ONE_ALPHA;
RXMOI:MO=RXOTX-152-2,BAND=GSM1900,MPWR=POWER,ANT=TWO_ALPHA;
RXMOI:MO=RXOTX-152-TRU_THREE,BAND=GSM1900,MPWR=POWER,ANT=THREE_ALPHA;
RXMOI:MO=RXOTX-152-4,BAND=GSM1900,MPWR=POWER,ANT=FOUR_ALPHA;
RXMOI:MO=RXOTX-152-5,BAND=GSM1900,MPWR=POWER,ANT=FIVE_ALPHA;
RXMOI:MO=RXOTX-152-6,BAND=GSM1900,MPWR=POWER,ANT=SIX_ALPHA;
RXMOI:MO=RXOTX-152-TRU_SEVEN,BAND=GSM1900,MPWR=POWER,ANT=SEVEN_ALPHA;
RXMOI:MO=RXOTX-152-8,BAND=GSM1900,MPWR=POWER,ANT=EIGHT_ALPHA;
RXMOI:MO=RXOTX-152-TRU_NINE,BAND=GSM1900,MPWR=POWER,ANT=NINE_ALPHA;
RXMOI:MO=RXOTX-152-10,BAND=GSM1900,MPWR=POWER,ANT=TEN_ALPHA;
RXMOI:MO=RXOTX-152-TRU_ELEVEN,BAND=GSM1900,MPWR=POWER,ANT=ELEVEN_ALPHA;
I would like a bit of awk script to scan the first input file antenna# file
for the text "RXOTX". It may find anywhere from 0-11 of them. They are
numbered by the last number after the final dash. like -0, -1, -2, and so
on.
When it finds that text, I would like it to grab $6 from each line and
replace the text "POWER" in the associated build# file (antenna1 and build1
must go together). The important part is that the $6 needs to be matched up
with the same RXOTX -0, -1, -2 number as in the antenna file.
So if it found RXOTX-11-2 and $6 was 44 inside the file antenna1, it would
match inside build# RXOTX-#-2 (the number after the first - should be
ignored, it may be different) and replace the text "POWER" with the $6 and
output to a new file called build_output_# (# being the same fn as used in
all the input files)
Would end up with:
RXMOI:MO=RXOTX-152-0,BAND=GSM1900,MPWR=45,ANT=ZERO_ALPHA;
RXMOI:MO=RXOTX-152-1,BAND=GSM1900,MPWR=45,ANT=ONE_ALPHA;
RXMOI:MO=RXOTX-152-2,BAND=GSM1900,MPWR=45,ANT=TWO_ALPHA;
RXMOI:MO=RXOTX-152-TRU_THREE,BAND=GSM1900,MPWR=POWER,ANT=THREE_ALPHA;
RXMOI:MO=RXOTX-152-4,BAND=GSM1900,MPWR=43,ANT=FOUR_ALPHA;
RXMOI:MO=RXOTX-152-5,BAND=GSM1900,MPWR=46,ANT=FIVE_ALPHA;
RXMOI:MO=RXOTX-152-6,BAND=GSM1900,MPWR=43,ANT=SIX_ALPHA;
RXMOI:MO=RXOTX-152-TRU_SEVEN,BAND=GSM1900,MPWR=POWER,ANT=SEVEN_ALPHA;
RXMOI:MO=RXOTX-152-8,BAND=GSM1900,MPWR=44,ANT=EIGHT_ALPHA;
RXMOI:MO=RXOTX-152-TRU_NINE,BAND=GSM1900,MPWR=POWER,ANT=NINE_ALPHA;
RXMOI:MO=RXOTX-152-10,BAND=GSM1900,MPWR=46,ANT=TEN_ALPHA;
RXMOI:MO=RXOTX-152-TRU_ELEVEN,BAND=GSM1900,MPWR=POWER,ANT=ELEVEN_ALPHA;
way to grab particular fields that I need from two files, then output to a
final file.
I have a multiple files called antenna# that looks like:
RXOTX-11-0 B00227A ALL GSM1900 BETAA 45
RXOTX-11-1 B00227A ALL GSM1900 BETAA 45
RXOTX-11-2 B00227A ALL GSM1900 BETAA 45
RXOTX-11-4 B00227B ALL GSM1900 BETAB 43
RXOTX-11-5 B00227B ALL GSM1900 BETAB 46
RXOTX-11-6 B00227B ALL GSM1900 BETAB 43
RXOTX-11-8 B00227C ALL GSM1900 BETAC 44
RXOTX-11-10 B00227C ALL GSM1900 BETAC 46
I have the same amount of files called build# that looks like:
RXMOI:MO=RXOTX-152-0,BAND=GSM1900,MPWR=POWER,ANT=ZERO_ALPHA;
RXMOI:MO=RXOTX-152-1,BAND=GSM1900,MPWR=POWER,ANT=ONE_ALPHA;
RXMOI:MO=RXOTX-152-2,BAND=GSM1900,MPWR=POWER,ANT=TWO_ALPHA;
RXMOI:MO=RXOTX-152-TRU_THREE,BAND=GSM1900,MPWR=POWER,ANT=THREE_ALPHA;
RXMOI:MO=RXOTX-152-4,BAND=GSM1900,MPWR=POWER,ANT=FOUR_ALPHA;
RXMOI:MO=RXOTX-152-5,BAND=GSM1900,MPWR=POWER,ANT=FIVE_ALPHA;
RXMOI:MO=RXOTX-152-6,BAND=GSM1900,MPWR=POWER,ANT=SIX_ALPHA;
RXMOI:MO=RXOTX-152-TRU_SEVEN,BAND=GSM1900,MPWR=POWER,ANT=SEVEN_ALPHA;
RXMOI:MO=RXOTX-152-8,BAND=GSM1900,MPWR=POWER,ANT=EIGHT_ALPHA;
RXMOI:MO=RXOTX-152-TRU_NINE,BAND=GSM1900,MPWR=POWER,ANT=NINE_ALPHA;
RXMOI:MO=RXOTX-152-10,BAND=GSM1900,MPWR=POWER,ANT=TEN_ALPHA;
RXMOI:MO=RXOTX-152-TRU_ELEVEN,BAND=GSM1900,MPWR=POWER,ANT=ELEVEN_ALPHA;
I would like a bit of awk script to scan the first input file antenna# file
for the text "RXOTX". It may find anywhere from 0-11 of them. They are
numbered by the last number after the final dash. like -0, -1, -2, and so
on.
When it finds that text, I would like it to grab $6 from each line and
replace the text "POWER" in the associated build# file (antenna1 and build1
must go together). The important part is that the $6 needs to be matched up
with the same RXOTX -0, -1, -2 number as in the antenna file.
So if it found RXOTX-11-2 and $6 was 44 inside the file antenna1, it would
match inside build# RXOTX-#-2 (the number after the first - should be
ignored, it may be different) and replace the text "POWER" with the $6 and
output to a new file called build_output_# (# being the same fn as used in
all the input files)
Would end up with:
RXMOI:MO=RXOTX-152-0,BAND=GSM1900,MPWR=45,ANT=ZERO_ALPHA;
RXMOI:MO=RXOTX-152-1,BAND=GSM1900,MPWR=45,ANT=ONE_ALPHA;
RXMOI:MO=RXOTX-152-2,BAND=GSM1900,MPWR=45,ANT=TWO_ALPHA;
RXMOI:MO=RXOTX-152-TRU_THREE,BAND=GSM1900,MPWR=POWER,ANT=THREE_ALPHA;
RXMOI:MO=RXOTX-152-4,BAND=GSM1900,MPWR=43,ANT=FOUR_ALPHA;
RXMOI:MO=RXOTX-152-5,BAND=GSM1900,MPWR=46,ANT=FIVE_ALPHA;
RXMOI:MO=RXOTX-152-6,BAND=GSM1900,MPWR=43,ANT=SIX_ALPHA;
RXMOI:MO=RXOTX-152-TRU_SEVEN,BAND=GSM1900,MPWR=POWER,ANT=SEVEN_ALPHA;
RXMOI:MO=RXOTX-152-8,BAND=GSM1900,MPWR=44,ANT=EIGHT_ALPHA;
RXMOI:MO=RXOTX-152-TRU_NINE,BAND=GSM1900,MPWR=POWER,ANT=NINE_ALPHA;
RXMOI:MO=RXOTX-152-10,BAND=GSM1900,MPWR=46,ANT=TEN_ALPHA;
RXMOI:MO=RXOTX-152-TRU_ELEVEN,BAND=GSM1900,MPWR=POWER,ANT=ELEVEN_ALPHA;