> How about echo abc | tr 'b' '\n' ?

tr substitutes characters only, while sed can work on arbitrary strings and
patterns. My guess is that the example was a simplified expression of a more
general requirement, in which case sed is appropriate and therefore,

echo aaabbbccc | sed -e 's,bbb,\
,'

will yield

aaa
ccc

as expected, while tr would give

aaa


ccc

which is almost certainly not wanted.

(Reminder: you need \\ if typing directly on the command line, or a single \
if entered in a script.)

Paul A. Scott
mailto:pscott@;skycoast.us
http://skycoast.us/pscott/


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message

Reply via email to