Hi all,
I have a file in the format:
14B
0
10
37 - this is going to be converted to hex
03B1
03B2
03B3
03B4 etc,
I want to assign the first 4 lines each to a variable
v1 v2 v3 v4
Then process the rest of the file using the variables to get the output
map dev 03B1 to dir 14B:0, target=10, lun=25 (HEX 37)
So far I've got
awk -v t1=$target -v l1=$lun '{print"map dev "$1" to dir 14B:0, target="t1", lun
="$(NF+1)=sprintf ("%x",NR+l1)";"}0' /input/file;
What I want is the above awk command to extract the first 4 lines from /input/file and assign them to internal variables. Then I can compile this into a .exe
Thanks in advance
I have a file in the format:
14B
0
10
37 - this is going to be converted to hex
03B1
03B2
03B3
03B4 etc,
I want to assign the first 4 lines each to a variable
v1 v2 v3 v4
Then process the rest of the file using the variables to get the output
map dev 03B1 to dir 14B:0, target=10, lun=25 (HEX 37)
So far I've got
awk -v t1=$target -v l1=$lun '{print"map dev "$1" to dir 14B:0, target="t1", lun
="$(NF+1)=sprintf ("%x",NR+l1)";"}0' /input/file;
What I want is the above awk command to extract the first 4 lines from /input/file and assign them to internal variables. Then I can compile this into a .exe
Thanks in advance