Tags

, , , , , , , ,

Display each different part of a string separated by a character, say colon (:), in new lines:

Using echo:
$ echo -e ${PATH//:/\\n}

Using printf:
$ printf "%s\n" ${PATH//:/\/* }

Here we chose the system $PATH variable whose different parts are separated by colons.

Credit: Command-line-fu

Advertisements