Section 1 of that page starts like this: ============================BEGIN The first awk You should see the contents of your /etc/passwd file appear before your eyes. Now, for an explanation of what awk did. When we called awk, we specified /etc/passwd as our input file. When we executed awk, it evaluated the print command for each line in /etc/passwd, in order. All output is sent to stdout, and we get a result identical to catting /etc/pass. Now, for an explanation of the { print } code block. In awk, curly braces are used to group blocks of code together, similar to C. Inside our block of code, we have a single print command. In awk, when a print command appears by itself, the full contents of the current line are printed. ============================END It starts speaking about something that you *should* see, but to see that, you actually would need to type a command, which is not specified. And yes, I know this is a literal transcription of this: http://www.ibm.com/developerworks/linux/library/l-awk1.html But that doesn't mean tha the article is correct. Since it is aimed to inform and serve the community, I think it should be corrected. These are the kind of things that misslead newcomers. The xml for that portion is this ============================BEGIN <title>The first awk</title> <body> <p> You should see the contents of your <path>/etc/passwd</path> file appear before your eyes. Now, for an explanation of what awk did. When we called awk, we specified <path>/etc/passwd</path> as our input file. When we executed awk, it evaluated the print command for each line in <path>/etc/passwd</path>, in order. All output is sent to stdout, and we get a result identical to catting <path>/etc/pass</path>. </p> <p> Now, for an explanation of the { print } code block. In awk, curly braces are used to group blocks of code together, similar to C. Inside our block of code, we have a single print command. In awk, when a print command appears by itself, the full contents of the current line are printed. </p> ============================END And I think it should be: ============================BEGIN <title>The first awk</title> <body> <pre caption="The first awk"> $ <i>awk '{ print }' /etc/passwd</i> </pre> <p> You should see the contents of your <path>/etc/passwd</path> file appear before your eyes. Now, for an explanation of what awk did. When we called awk, we specified <path>/etc/passwd</path> as our input file. When we executed awk, it evaluated the print command for each line in <path>/etc/passwd</path>, in order. All output is sent to stdout, and we get a result identical to catting <path>/etc/pass</path>. </p> <p> Now, for an explanation of the { print } code block. In awk, curly braces are used to group blocks of code together, similar to C. Inside our block of code, we have a single print command. In awk, when a print command appears by itself, the full contents of the current line are printed. </p> ============================END Note that print has no arguments, which makes concordance with the following paragraph, that explains that using $0 is the same than using nothing at all. ============================BEGIN <pre caption="Printing the current line"> $ <i>awk '{ print $0 }' /etc/passwd</i> $ <i>awk '{ print "" }' /etc/passwd</i> </pre> <p> In awk, the $0 variable represents the entire current line, so print and print $0 do exactly the same thing. </p> ============================BEGIN I hope that makes sense. English is not my native language, but I think I am right, and this should be corrected because it confuses people, harming the whole purpose that the article was written for, which is to tearch people. Reproducible: Always Steps to Reproduce: 1. Just open the url and read. 2. 3.
(In reply to comment #0) > I hope that makes sense. It would make a whole *lot* more sense if you attached a unified diff...
(In reply to comment #1) > (In reply to comment #0) > > I hope that makes sense. > > It would make a whole *lot* more sense if you attached a unified diff... > Of course, I know. I just wanted to make sure that the document was changeable before submiting anything. I will submit it briefly.
Created attachment 140502 [details] l-awk1.diff Patch to gentoo/xml/htdocs/doc/en/articles/l-awk1.xml, added one example that was missing.
Normally, I would point you to the line of the disclaimer that reads "This document is not actively maintained.", but in this case, yeah . . . dunno where the heck that first example went! Thanks for providing one. I also made a couple of other small changes to the paragraph below it. Thanks for reporting, fixed in CVS.
(In reply to comment #4) > Normally, I would point you to the line of the disclaimer that reads "This > document is not actively maintained.", but in this case, yeah . . . dunno where > the heck that first example went! Thanks for providing one. I also made a > couple of other small changes to the paragraph below it. > > Thanks for reporting, fixed in CVS. > Yes, that was why, in first place, I was not sure about the bug report. I know it is not maintained, but I felt this is something critical, and with an easy solution. I stumpped with this because I am translating the Awk by example series to spanish. I don't know where it went either, but it is not either in the original link form the ibm site I posted above. So, I don't think that the error was made on the Gentoo side, but rather on the drobbins side or the ibm site. Thanks to you for attending my petition, and thanks for applying the fix. I will checkout and make sure that the spanish translation includes the correct version numbers and all the fixes. Thanks again.
(In reply to comment #5) > I don't know where it went either, but it is not either in the original link > form the ibm site I posted above. So, I don't think that the error was made on > the Gentoo side, but rather on the drobbins side or the ibm site. Yeah, it's either IBM's fault, or Daniel didn't include it in the draft he sent them. I checked our CVS history, and that example's never been in the Gentoo versions.