Jarrod13
Programmer
- Dec 18, 2008
- 12
Okay,
I'm having a problem with an awk program I'm working on.
What I'm doing is checking the entire file for a hex non printable character. This is how I do it:
for(f = 0; f <= NR; f++){
if (match($0, /\x1B/) != 0)
{
NON_PRINT_CHAR = 1;
}
getline < MYFILENAME;
}
Now, the problem I have is with "getline < MYFILENAME" Once the loop is done running it sets $0 to the last record in the file.
When I try and write another function to perform a certain task it won't work because it starts processing at the current value of $0 which is at the end of the file.
Is there a better way to write this loop so that it won't change the value of $0 but at the same time traverse every record in the file?
Any help is greatly appreciated! Thank you!
I'm having a problem with an awk program I'm working on.
What I'm doing is checking the entire file for a hex non printable character. This is how I do it:
for(f = 0; f <= NR; f++){
if (match($0, /\x1B/) != 0)
{
NON_PRINT_CHAR = 1;
}
getline < MYFILENAME;
}
Now, the problem I have is with "getline < MYFILENAME" Once the loop is done running it sets $0 to the last record in the file.
When I try and write another function to perform a certain task it won't work because it starts processing at the current value of $0 which is at the end of the file.
Is there a better way to write this loop so that it won't change the value of $0 but at the same time traverse every record in the file?
Any help is greatly appreciated! Thank you!