How do I change a delimiter in Unix?
Answer
Shell script to change the delimiter of a file:
Using the shell substitution command, all the commas are replaced with the colons. ‘${line/,/:}’ will replace only the 1st match. The
extra slash in ‘${line//,/:} ‘ will replace all the matches. Note: This method will work in bash and ksh93 or higher, not in all flavors.
Answer
Shell script to change the delimiter of a file:
Using the shell substitution command, all the commas are replaced with the colons. ‘${line/,/:}’ will replace only the 1st match. The
extra slash in ‘${line//,/:} ‘ will replace all the matches. Note: This method will work in bash and ksh93 or higher, not in all flavors.