grep or a simple script?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • netrom
    New Member
    • Apr 2008
    • 10

    #16
    I'm eager to test it Paul! Will let you know.

    Many thanks!

    Comment

    • netrom
      New Member
      • Apr 2008
      • 10

      #17
      Here's the problem, Paul:

      when I just cut the file1_test I'll receive different output:

      $ cut -c 63-78 file1_test

      454353455434463 7
      524353454353401 7
      534534534534437 0
      545435345344550 5
      544534543534221 6

      and then the second cut:

      $ cut -c 183-188 file1_test

      970232
      R63908
      941080
      711285
      053621

      But when running your script the output, $STR1 and $STR2 is different. So it seems like when you read the file with cat and put the result in $LINE - it's a bit different and it actually 'changes' the structure of the records....

      Is there a solution to this?

      Thanks in advance.

      Comment

      • prn
        Recognized Expert Contributor
        • Apr 2007
        • 254

        #18
        Originally posted by netrom
        Here's the problem, Paul:
        ...
        But when running your script the output, $STR1 and $STR2 is different. So it seems like when you read the file with cat and put the result in $LINE - it's a bit different and it actually 'changes' the structure of the records....

        Is there a solution to this?

        Thanks in advance.
        Hi Netrom,

        I haven't managed to figure out just exactly what the problem is, but I think I can confidently say that the script does not 'change' the file structure.

        It looks a lot like it has something to do with the character encoding in the file. I also note that when I examine the file with "less" it is different from what it looks like if I use emacs or vi. It looks like you are Magyar (Hungarian for the English speakers :) ) so it does not surprise me that you are using a different character encoding, but what I don't yet understand is why it is showing up differently in the script from when you just type the command at the prompt. I looked at the environment by typing "env" at the prompt and by putting the same command in the script and did could not find any interesting differences.

        At the moment, I don't understand what could be causing this difference when the same command is run in the script and at the prompt. It ought to be something about the environment, but that does not seem to be the case. In particular, the LANG environment variable, which in my case is LANG=en_US, is the same in both situations.

        I'll undoubtedly have more thoughts in a while, but right now, I'm puzzled.

        Paul

        Comment

        • netrom
          New Member
          • Apr 2008
          • 10

          #19
          Thank you very much Paul.

          Comment

          Working...