Find the answer to your Linux question:
Results 1 to 8 of 8
Hi guys,i come across this error when i type in the command sed: infinite branch loop at line 51 I heard that it is due to the version of sed,do ...
  1. #1
    Just Joined!
    Join Date
    Sep 2007
    Posts
    25

    Where to get new version of sed?

    Hi guys,i come across this error when i type in the command

    sed: infinite branch loop at line 51

    I heard that it is due to the version of sed,do anyone knw where to get new version of sed which will solve this problem?thanks alot,will be waiting for reply

  2. #2
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    Are you running HHsed?

    What operating system are you running? Linux? Microsoft Something?

  3. #3
    Just Joined!
    Join Date
    Sep 2007
    Posts
    25
    i using ms-dos to run sed program..so hoping anyone knw where to get the sed program in batch file format..then i can just replace it by the original sed program,thanks alot

  4. #4
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    First, you're using HHsed, version 1.5.

    Second, according to this faq,
    HHsed will not read more than 50 lines into the pattern space via an N command, even if the pattern space is only a few hundred bytes in size. HHsed exits with an error message, "infinite branch loop at line {nn}".
    So if you're not intending to read more than 50 lines into the pattern space, fix your script. :)

    Third, there seems to be no later version of HHsed than 1.5. Someone has stepped into the breach, though, and written a successor to HHsed. You can get it here.

    Naturally, you should only bother to install that if you're sure you want more than 50 lines in the pattern space.

    Hope this helps.

  5. #5
    Just Joined!
    Join Date
    Sep 2007
    Posts
    25
    thanks alot,i will try it out ba..haha..hope it work

  6. #6
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    Um, wait. It's unusual to want more than 50 lines in the pattern space. If that's not your intent, then trying a new version of sed isn't worth the effort. Just what are you trying to do with sed?

  7. #7
    Just Joined!
    Join Date
    Sep 2007
    Posts
    25
    i was trying the append the line to the previous line,the sentences always start with @PDividerP,so i type this command

    sed -e :a -e "$!N;s/\n@PDividerP/ @PDividerP/;ta" -e "P;D" text1.txt>text2.txt

    but it end up giving the above error,i think is becos the lines i wanna append to the previous line is too many..so i am trying to see if newer version of sed will work in this case.

  8. #8
    Just Joined!
    Join Date
    Aug 2007
    Posts
    37
    I think you're trying to push sed beyond it's limits.

    If you just want to replace all the newlines in a file with spaces you'd be better off using 'tr':
    Code:
    tr '\012' ' ' <text1.txt >text2.txt
    If only some of the lines start with '@PDividerP' then this should work if you're using bash:
    Code:
    file_contents=$(<text1.txt)
    echo "${file_contents//
    @PDividerP/ @PDividerP}" >text2.txt

Posting Permissions

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