Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple lines in one 1

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi guys,
I want to joing multiple line in one

ex
This is a
test
for multilple line.
Does it
work?


I want it to be like
This is a test for multiple line. Does it work?

I am very new to unix.

thanks for your help
Ani
 
Hi:

Assuming you example is in f.file and using ksh, the easiet way is to read each word and print it out:

#!/bin/ksh
while read x
do
printf "%s " $x
done < f.file

Regards,


Ed
 
Here's a sed sol'n.

sed -e :a -e '$!N;s/ *\n/ /;ta' < f.file
Cheers,
ND [smile]

bigoldbulldog@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top