Thursday, 15 July 2010

linux - Very strange behavior in awk -


I have run a very strange behavior in awk.

The following is an input file: <

My awk script is as follows:

  / ^ / {print "ss", < / P> 
  ABCD Yes EFG Yes  

$ 2, "DD \ n"}

I hope that The following is:

  ss yes dd ss yes dd  

But, surprisingly, the result is:

  DdYes ddYes  

Where is my "ss" and how is engage in yes behind "DD"?

In the input file are DOS Newline \ r character at the end of each row Is getting the output as part of the $ 2 and reset the inclusion point to start that line, from which point to , and DD is then printed to overwrite the initial ss . (You can either modify the ss prefix or dd suffix length to look more clearly.)

Strip from and move away from it.


No comments:

Post a Comment