Help on Merge multi-lines into one single line

Hello,

Can anyone let me know how to use Perl script to Merge following multi-lines into one single line...

***** Multi-line*****
FILE_Write root OK Tue Jul 01 00:00:00 2008 cl_get_path
file descriptor = 1
FILE_Write root OK Tue Jul 01 00:00:00 2008 cp
file descriptor = 4


***** Single-line*****
FILE_Write root OK Tue Jul 01 00:00:00 2008 cl_get_path file descriptor = 1
FILE_Write root OK Tue Jul 01 00:00:00 2008 cp file descriptor = 4


Thank You

HappyDay

this sed command will do it

sed '
/^[ ]*$/ !{
N
s/\n/ /
}
' filename

To keep the forums high quality for all users, please take the time to format your posts correctly.

First of all, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags

```text
 and 
```

by hand.)

Second, avoid adding color or different fonts and font size to your posts. Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.

Third, be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.

Thank You.

The UNIX and Linux Forums

http://www.unix.com/shell-programming-scripting/109332-how-use-perl-merge-multi-line-into-single-line.html

Neo,

Thanks for the comments, will follow it next time

HappyDay

$/="FILE";
open $fh,"<","a.spl";
while(<$fh>){
	chomp;
	s/\n/ /g;
	print "FILE",$_,"\n" if $_;
}