Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: Problem whith shell script

  1. #11
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,729

    Default Re: Problem whith shell script

    Quote Originally Posted by Azeva View Post
    Any jedi master can , please, explain his when having some time ?

    You mean you removed the space character before the newline indication?

    I can not explain that. The more because, as I have shown, I do not have the problem at all. And I am not alone in not being able to reconstruct your problem.
    Henk van Velden

  2. #12

    Default Re: Problem whith shell script

    Quote Originally Posted by hcvv View Post
    You mean you removed the space character before the newline indication?

    I can not explain that. The more because, as I have shown, I do not have the problem at all. And I am not alone in not being able to reconstruct your problem.
    Yes, I did only that, nothing more.

  3. #13
    Join Date
    Sep 2012
    Posts
    4,945

    Default Re: Problem whith shell script

    Quote Originally Posted by Azeva View Post
    Any jedi master can , please, explain his when having some time ?
    Code:
    bor@bor-Latitude-E5450:/tmp$ ./foo1.sh
    Simple test ...
      2018-02-01 X X
      2018-02-01   X
    bor@bor-Latitude-E5450:/tmp$ ./foo2.sh
    Simple test ...
    A 2018-02-01 X X
    C 2018-02-01   X
    bor@bor-Latitude-E5450:/tmp$ cat teste.txt 
    A;2018-02-01;X;X
    C;2018-02-01; ;X
    bor@bor-Latitude-E5450:/tmp$ hexdump -C teste.txt 
    00000000  41 3b 32 30 31 38 2d 30  32 2d 30 31 3b 58 3b 58  |A;2018-02-01;X;X|
    00000010  0d 0a 43 3b 32 30 31 38  2d 30 32 2d 30 31 3b 20  |..C;2018-02-01; |
    00000020  3b 58 0d 0a                                       |;X..|
    00000024
    bor@bor-Latitude-E5450:/tmp$

  4. #14
    Join Date
    Jan 2017
    Location
    Nürnberg, Germany
    Posts
    142

    Default Re: Problem whith shell script

    Quote Originally Posted by arvidjaar View Post
    Code:
    00000020  3b 58 0d 0a                                       |;X..|
    Oh, a DOS-/Windows line ending (hex 0d == carriage return, 0a == new line, aka line feed) — it's not a UNIX text file. Yup, that can screw up your parsing.

    Either read over the 0x0d bytes while parsing, or filter them out, or use the dos2unix command to convert the file(s) with DOS linebreaks into files with Unix linebreaks beforehand.

    It's funny that, in our 21th century full of Unicode text with even hundreds of emoji defined, those 40-years old line-break bugs can still bite us.
    Cheers!

  5. #15
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    2,415

    Smile Re: Problem whith shell script

    @Azeva:

    Take a look at the output of “file” with respect to the CSV input file:
    Code:
     > file testeDOS.txt teste.txt
    testeDOS.txt: ASCII text, with CRLF line terminators
    teste.txt:    ASCII text
     >

  6. #16

    Default Re: Problem whith shell script

    Thanks brothers !!!

  7. #17

    Default Re: Problem whith shell script

    Quote Originally Posted by unix111 View Post
    Oh, a DOS-/Windows line ending (hex 0d == carriage return, 0a == new line, aka line feed) — it's not a UNIX text file. Yup, that can screw up your parsing.

    Either read over the 0x0d bytes while parsing, or filter them out, or use the dos2unix command to convert the file(s) with DOS linebreaks into files with Unix linebreaks beforehand.

    It's funny that, in our 21th century full of Unicode text with even hundreds of emoji defined, those 40-years old line-break bugs can still bite us.
    Cheers!

    Thanks man !!!

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •