[vim, sed and vi] cannot :s/something/\n

Hello again, forums.
Got a strange problem with vim:
Some file:
Code:
some text here
Running
[CMD=":"]%s/ /\n/g[/CMD]
results in:
Code:
some^@text^@here
With vi, problem is (almost) same, the space symbols are just wiped out, e.g.:
Code:
sometexthere
locale, if matters: en_us.utf-8, no changes with c.
vimrc is very simple:
Code:
set nocp
syntax on
set autoindent "autoindenting
set expandtab "tab to space
set softtabstop=4 "tab = 4 space
set ignorecase "ignore case while searching
set background=dark "dark background
set hlsearch "highlight all fount results
set backup  "backup files
set incsearch "jump to found text while typing
set virtualedit=all
and problem is same with empty .vimrc
Problem is same with sed (as vi's), but not with tr & awk.
world was updated 11 days ago, 8-STABLE.
What is happening and how do i fix this?
 
Using gsed from textproc/gsed allows you to use escape characters in the replacement string.

Code:
echo "foo bar zot" | gsed 's/ /\n/g'
foo
bar
zot

Linux uses GNU sed, FreeBSD does not. Perhaps that's the source of the confusion.
 
Back
Top