Sharing a subtle awk problem 
Author Message
 Sharing a subtle awk problem

I have just surfaced from a very trying debugging session (I must be getting
old!) on a very short awk program

The problem was related to the fact that I used the 'sub' function on $NF

I failed to remember that altering any of the $-variables, effects $0
by squashing multiple spaces.....
For some reason it was doing this even if the sub function failed to perform

Try this

{sub("3", "", $NF); print}

on data like
1 4      6
1  5   3

Beware.....

Mark
--
Mark Katz
ISPC, London - Innovation in data-delivery tools
Tel: (44) 181-455 4665, Fax (44) 181-458 9554
** Visit our website on http://www.*-*-*.com/ **



Mon, 24 Apr 2000 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. subtle php/MS-Access problem

2. way of sharing functions in AWK

3. subtle bug in HTTP client

4. Subtle Smalltalk advantage over Java ?

5. Win2K Subtle Changes

6. A subtle bug in pthread: another case

7. Subtle bug in Ruby/Tk? (Attn: Hidetoshi Nagai)

8. A subtle bug found

9. Backslash Newline - a subtle bug

10. Subtle trap in Tcl_UtfTo(Lower|Upper|Title)

11. Subtle user trap with auto loading

12. subtle bug/feature of switch statements

 

 
Powered by phpBB® Forum Software