How do I replace a space in a text file?
Answer
A few choices:
Answer
A few choices:
- The classic, use tr : tr ‘ ‘ ‘n’ < example.
- Use cut cut -d ‘ ‘ –output-delimiter=$’n’ -f 1- example.
- Use sed sed ‘s/ /n/g’ example.
- Use perl perl -pe ‘s/ /n/g’ example.
- Use the shell foo=$(cat example); echo -e ${foo// /\n}