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 ...
- 10-05-2007 #1Just 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
- 10-05-2007 #2
Are you running HHsed?
What operating system are you running? Linux? Microsoft Something?
- 10-05-2007 #3Just 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
- 10-05-2007 #4
First, you're using HHsed, version 1.5.
Second, according to this faq,
So if you're not intending to read more than 50 lines into the pattern space, fix your script. :)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}".
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.
- 10-08-2007 #5Just Joined!
- Join Date
- Sep 2007
- Posts
- 25
thanks alot,i will try it out ba..haha..hope it work
- 10-08-2007 #6
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?
- 10-08-2007 #7Just 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.
- 10-08-2007 #8Just 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':
If only some of the lines start with '@PDividerP' then this should work if you're using bash:Code:tr '\012' ' ' <text1.txt >text2.txt
Code:file_contents=$(<text1.txt) echo "${file_contents// @PDividerP/ @PDividerP}" >text2.txt


Reply With Quote