LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   something wrong when extracting TR file by awk (https://www.linuxquestions.org/questions/linux-newbie-8/something-wrong-when-extracting-tr-file-by-awk-903468/)

aicaicai 09-20-2011 06:31 AM

NO,I working on ubuntu 11.04

rigor 09-20-2011 10:30 PM

Hi aicaicai,

Rather than uploading your awk program as an attachment to your post on linuxquestions.org you put your awk program in your question. So I copied your awk program text by selecting it with my mouse, and pasting it into an editor in Linux.

Some things that check for errors in programming languages don't count comments when they give line numbers in which errors occur. So if line 1 is a comment, with line 2 the first line of code, if there is an error in line 2, they might report an error in line 1.

I practically don't notice it anymore. If I'm given the type of error and pointed to a line near the line in which I made the error, I can usually find my mistake.

But when you mentioned that awk was complaining about line 1 in what I sent you, I double checked. The awk I'm using with Linux doesn't ignore comments when counting line numbers for errors. In the awk you are using with Linux, Line 1 in the program you sent, probably is the first comment line.

There are various so called "character sets" for use in text files. In an awk program I normally only use characters from the US-ASCII character set.

In principle, you have to be using a different character set, because the characters in the comments in the awk program you showed us, don't exist in the US-ASCII character set.

But the editor I often use with Linux, by default allows for character set UTF-8, even though I normally don't make use of the extra character codes that UTF-8 allows.

As a result of all that, when I sent you changes to your original program, the character codes in the comments may have been different than they originally were.

The character code that awk mentioned in the error message, 0xff is the highest value that will fit in a single byte. That seemingly made the probability very high, that the issue was a character set problem.

That's why I suggested you remove the comments and see if you still got the error message.


All times are GMT -5. The time now is 04:50 PM.