bibi92
asked on
sed command on several file in folder
Hello,
How to execute below command on several files in a folder :
sed 's/$/\r/' server_*.txt > server_*.txt
Thank you
Regards
How to execute below command on several files in a folder :
sed 's/$/\r/' server_*.txt > server_*.txt
Thank you
Regards
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hello
I have to change LF (\n) with CRLF (\r\n)
Thank you
Regards
I have to change LF (\n) with CRLF (\r\n)
Thank you
Regards
Your attempt is to add a \r at the end of the line. \n\r is the end result of your script
Are you certain you currently do not have \r\n?
sed -pi.bak -e 's/\n/\r\n/g' list_of_files
How are you seeing that it is not present?
Are you certain you currently do not have \r\n?
sed -pi.bak -e 's/\n/\r\n/g' list_of_files
How are you seeing that it is not present?
Hi Arnold, my sed command changes \n to \r\n as we hoped.
Also, 's/\n/\r\n/' doesn't do anything, since the substitution command never sees the "\n" (it only processes the text before the \n).
Also, 's/\n/\r\n/' doesn't do anything, since the substitution command never sees the "\n" (it only processes the text before the \n).
ASKER
Hello,
Are you certain you currently do not have \r\n? no because files txt are generated on linux servers and transferred on windows server for import them.
So I will test Simon script tomorrow.
Thank you
Are you certain you currently do not have \r\n? no because files txt are generated on linux servers and transferred on windows server for import them.
So I will test Simon script tomorrow.
Thank you
When you transfer files from linux to windows, what are you uaing?
If FTP, make sure to use ASCII mode
How does this ahow.up?
If FTP, make sure to use ASCII mode
How does this ahow.up?
Are you sure you are not inverting?
cat -v
Do you have ^M and that is what you want removed?
Dos2unix will fix left behind \r when transferring files
If you are using FTP to transferfiles, to avoid this issue an ascii cms before transferring text files.,
sed -pi.bak to create a backup file on which it acted.
Your attempt creates ambiguity