bug-sed
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#49873: Replacing all \n with spaces doesn't work in GNU sed as expec


From: AlvinSeville7cf
Subject: bug#49873: Replacing all \n with spaces doesn't work in GNU sed as expected
Date: Wed, 4 Aug 2021 20:27:07 +1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

Hello! I want to read entire file and then replace all *\n* with space. My sed script is (I know that it is not optimal but it demonstrates problem):

|:a $! { N; ta } s/\n/ /g p |

So why even with *g* flag *s* command replaces only first *\n* in pattern space? For instance I have the following file:

|It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, |

The result of script execution is:

|It was the best of times, it was the worst of times, it was the age of wisdom, it was |

I use GNU sed 4.8. It seems to be a bug.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]