Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RE: HP-UX awk weird "feature" -t

Status
Not open for further replies.

polar1

MIS
May 14, 2001
31
US
Interesting.
I have the same results with AWK on POSIX. I noticed a couple of things from the examples displayed.
In the post: 1:) aside from the full string [a-z] at or about 19 lines down, the bottom line did not end with the letter "z". The example from AIX showed no bottom line ending with "z" as well.
2:) Running the command I noticed 2 null lines before the output suggesting 28 loops instead of 26.

I found this to work:
for l in [ a b c d e f g h i j k l m n o p q r s t u v w x y z ] ; do echo abcdefghijklmnopqrstuvwxyz |awk -F [$l] '{print NF ":" $l}' ; done
I added NF to the print command to give more information.
However I am not sure where the two extra loops (at the beginning) are coming from.



 
Get rid of the brackets: [ ]

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
oops! print - should be $1 instead of $l.

When I do not use the brackets the last line is missing the "z" and the 19th line prints the entire string. Same as the original post.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top