domenicodl
Programmer
Hi,
I would lie to know how to remove the new line from a string.
Googling I found the command prints(%s, $0) that is not what I'm looking for.
I have to parse a file like the following one
000020E0 3D 20 00 40 lis r9,400000
000020E4 39 29 A0 00 addi r9,-6000
000020E8 80 09 00 00 lwz r0,00(r9)
000020EC 7C 03 03 78 mr r3,r0
000020F0 81 61 00 00 lwz r11,00(r1)
000020F4 83 EB FF FC lwz r31,-04(r11)
000020F8 7D 61 5B 78 mr r1,r11
Since I want to count the occurrence of each "rx" string (e.g., r1 appears 1, r9, 3 times and so on)
The fragment of code with which I find the string rx is the following
register = $7;
split(register,r,",");
for (i in r){
sub(/\)/,"",r); #I remove "() -" that I do not need
sub(/\(/,"",r);
sub(/\-/,"", r);
Now from the r I have to remove also the new line, how can I do it?
of course I can't use the command printf(%s, r) because I need to use r for further processing and not to print it.
Thank you in advance.
I would lie to know how to remove the new line from a string.
Googling I found the command prints(%s, $0) that is not what I'm looking for.
I have to parse a file like the following one
000020E0 3D 20 00 40 lis r9,400000
000020E4 39 29 A0 00 addi r9,-6000
000020E8 80 09 00 00 lwz r0,00(r9)
000020EC 7C 03 03 78 mr r3,r0
000020F0 81 61 00 00 lwz r11,00(r1)
000020F4 83 EB FF FC lwz r31,-04(r11)
000020F8 7D 61 5B 78 mr r1,r11
Since I want to count the occurrence of each "rx" string (e.g., r1 appears 1, r9, 3 times and so on)
The fragment of code with which I find the string rx is the following
register = $7;
split(register,r,",");
for (i in r){
sub(/\)/,"",r); #I remove "() -" that I do not need
sub(/\(/,"",r);
sub(/\-/,"", r);
Now from the r I have to remove also the new line, how can I do it?
of course I can't use the command printf(%s, r) because I need to use r for further processing and not to print it.
Thank you in advance.