User Tools

Site Tools


sed:replace_space_with_newline

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
sed:replace_space_with_newline [2020/07/15 09:30] – external edit 127.0.0.1sed:replace_space_with_newline [2020/08/16 11:30] (current) – removed 192.168.1.1
Line 1: Line 1:
-====== 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 
-</code> 
- 
- 
-2. awk 
- 
-<code bash> 
-echo "one two three" | awk '$1=$1' RS= OFS="\n" 
- 
-one 
-two 
-three 
-</code> 
- 
- 
-3. tr 
- 
-<code bash> 
-$ echo "one two three" | tr -s ' ' '\n' 
- 
-one 
-two 
-three 
-</code> 
  
sed/replace_space_with_newline.1594805433.txt.gz · Last modified: 2020/07/15 09:30 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki