What if you want to have just one single pipeline that will create a file (let's say x) and we want all the content from another file (we can call it y), one word per line?
awk '{ for (i=1;i<=NF;++i) {print i"\n"}}' y > x
Interesting question. If you really want to use a single pipe, how about the following?
$ cat infile
The quick brown fox jumped
over the fence
and ran into the woods
$ tr '[:space:]' '\n' < infile | cat - > outfile
$ cat outfile
The
quick
brown
fox
jumped
over
the
fence
and
ran
into
the
woods
tr -s ' \011' '\012' <input.txt >output.txt
There's a space at the front of the tr first quoted arg. The 011 matches a tab. Assumes a *ix env with 012 (octal) linefeeds.
The character class [:space:] is more portable since it covers all whitespace in all locales.
Portable meaning contemporary Unix/Linux... yes... then I agree with your statement.
xargs -n1 <infile >outfile
$ cat infile
The quick brown fox jumped
over the fence
and ran into the woods
$ xargs -n1 <infile >outfile
$ cat outfile
The
quick
brown
fox
jumped
over
the
fence
and
ran
into
the
woods
$
Hi,
Another way:
$ cat infile
The quick brown fox jumped
over the fence
and ran into the woods
$ printf "%s\n" $(<infile) >outfile
$ cat outfile
The
quick
brown
fox
jumped
over
the
fence
and
ran
into
the
woods
Regards.