Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!
Credits 2,343 Posts 636 Joined 2004-03-06 00:00 22-year member UID 19350 Gender Male
Status Offline
Found the GNU sed 4.0.7 under win32
Solved the problem of trailing spaces
But encountered a new problem
Want to replace \n\n\n with ;\n\n\n
Use
sed -e "s/\n\n\n/;\n\n\n/g" data.txt
Not working
Credits 2,343 Posts 636 Joined 2004-03-06 00:00 22-year member UID 19350 Gender Male
Status Offline
Strangely enough, using sed -e "s/\\n/\n/g" data.txt can replace the \n text in the text with a carriage return. That is to say, the \n such escape characters cannot be recognized in the text to be searched.
C:\Test>sed --version
GNU sed version 4.1.4 (DJGPP port 2005-04-01 (r2))
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE,
to the extent permitted by law.
Credits 5 Posts 5 Joined 2010-01-24 16:36 16-year member UID 159369 Gender Male
Status Offline
Use sed to delete trailing spaces. The output format is non-DOS format. When opened in Notepad, it doesn't wrap lines. When opened in UE, it prompts to convert to DOS mode. How to handle it?