Merge 2 lines in file

Hi All,
I have a data in flat file like below. Some of the information are in second row.

 
111_ABCProcess -----            -----            IN 0/0
111_PQRTrimPRocess
                             -----            -----            OI 0/0
111_ZigZagTrimProcess -----            -----            IN 0/0
111_CommandLoadProcess
                             09/22/2009 07:23 09/22/2009 07:23 FA 21960994/13 255
111_MurtyDumpProcess  01/30/2008 13:04 01/30/2008 13:07 SU 21960994/11

I am using following code to merge 2 lines, if data are in 2 lines.

 
aa=" "
cat rawdata.txt | while read abc
do 
 if [[ `echo $abc | cut -c1-1` = "-" ]] || [[ `echo $abc | cut -c3` = "/" ]]
 then 
  prevline="$prevline$aa$abc" 
 else 
  prevline=$abc 
 fi
 echo $prevline >> rawdata_1.txt
done

But, it is taking too much time. I have arounf 3000 records in the file. Is there any other fast possible ways to do so... ie awk, nawk...?

Hello,

Try this:

awk '!/^ /{a=$0;print}/^ /{print a,$0}' file

If you want to get rid of the multiple spaces, use gsub() function.

---------- Post updated at 09:22 AM ---------- Previous update was at 09:15 AM ----------

Sorry. That snippet needs some fixing. Better try this:

awk '!/^ /{if(a) print a; a=$0}/^ /{print a,$0}END{print a}' file