ubuntu:sed:replace_space_with_newline
Differences
This shows you the differences between two versions of the page.
ubuntu:sed:replace_space_with_newline [2019/12/04 20:08] – created peter | ubuntu:sed:replace_space_with_newline [2019/12/10 18:39] (current) – removed peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Ubuntu - SED - Replace space with newline ====== | ||
- | |||
- | There are a few ways to achieve that: | ||
- | |||
- | 1. sed | ||
- | |||
- | <code bash> | ||
- | echo "one two three" | sed 's/ /\n/g' | ||
- | |||
- | one | ||
- | two | ||
- | three | ||
- | </ | ||
- | |||
- | |||
- | 2. awk | ||
- | |||
- | <code bash> | ||
- | echo "one two three" | awk ' | ||
- | |||
- | one | ||
- | two | ||
- | three | ||
- | </ | ||
- | |||
- | |||
- | 3. tr | ||
- | |||
- | <code bash> | ||
- | $ echo "one two three" | tr -s ' ' ' | ||
- | |||
- | one | ||
- | two | ||
- | three | ||
- | </ | ||
ubuntu/sed/replace_space_with_newline.1575490100.txt.gz · Last modified: 2020/07/15 09:30 (external edit)