Posted in Command Line, Linux, Perl Replace \n with another String Binny V A June 29, 2007 1 Comment on Replace \n with another String The command to convert all \n in a file to another string – very useful for list code generation. perl -ne 's/\\n/\',\'/g;print;' file.txt>new.txt Author: Binny V AA philosopher programmer who specializes in backend development and stoicism.
Hi, Why not try the simple ‘tr’ in Linux that does not expect you to have perl or any other dependencies. Reply
Hi,
Why not try the simple ‘tr’ in Linux that does not expect you to have perl or any other dependencies.