[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Sed or Awk Question



On Die, 14 Jan 2003 at 13:42 (-0500), Jody Grafals wrote:
> 
> Dose anyone know how to replace a line break with a space using sed or
> awk?
> 
> for example 
> 
> cat
> dog 
> goat 
> duck 
> 
> would become 
> 
> cat dog goat duck 

You don't need to use sed or awk:

jan@k500:~/tmp> x=`cat animals`
jan@k500:~/tmp> echo $x
cat dog goat duck

or:
jan@k500:~/tmp> cat animals | tr '\n' ' '
cat dog goat duck jan@k500:~/tmp>

Jan



Reply to: