Concatenate some of the rows...

i have a file as below and i need to load it into oracle. The problem is, some of the rows are in 2 lines.

 
123456_PosWlist -----            -----            IN 0/0
123456_PosWListRpt   -----            -----            IN 0/0
123456_PosWListCSV
                      -----            -----            IN 0/0
123456_PosWlist_S1CSVBox   -----            -----            IN 0/0
123456_PosWList_S1CSV    -----            -----            IN 0/0
123456_PosWList_S1PubCSV -----            -----            IN 0/0

for example,

123456_PosWListCSV 

is not continues... after name all other information are in next line...
Can someone help me on how to concanate this 2 rows... I have nearly 500 rows in the file out of it 50 rows have this problem...

if you're not *too* bothered about whitespace:

#   tr -s " " "\n"  < infile  | paste - - - - -
123456_PosWlist -----   -----   IN      0/0
123456_PosWListRpt      -----   -----   IN      0/0
123456_PosWListCSV      -----   -----   IN      0/0
123456_PosWlist_S1CSVBox        -----   -----   IN      0/0
123456_PosWList_S1CSV   -----   -----   IN      0/0
123456_PosWList_S1PubCSV        -----   -----   IN      0/0

HTH

sed -n '/^[0-9][0-9]*_Pos/{
1{h;}
1!{
$!{x;s/\n/ /g;p;}
${x;s/\n/ /g;p;x;p;}
}
}
/^[0-9][0-9]*_Pos/!{
$!{H;}
${H;x;s/\n/ /g;p;}
}' yourfile

an awk verison :

awk 'NF==1 {p=$0;next} {$0=p$0;print;p=""}' file_name.txt

Hi Panyam...

awk version shows following error...

bash-2.03$ more aaa.txt
  35111_RetrievalAppendXmitTrig
                             -----            -----            OI 0/0

bash-2.03$ awk 'NF==1 {p=$0;next} {$0=p$0;print;p=""}' aaa.txt
awk: can't set $0
 record number 2

Use gawk/nawk. The same worked for me.

Hi Panyam,

It worrs with nawk. But it works only if the file contains one row. If i have data as below.

123456_PosWListCSV
                      -----            -----            IN 0/0
123456_PosWlist_S1CSVBox   -----            -----            IN 0/0
123456_PosWList_S1PubCSV 
                      06/17/2008 13:25            06/17/2008 13:47            IN 0/0

The above awk command is not working.

It should come like...

123456_PosWListCSV   -----            -----            IN 0/0
123456_PosWlist_S1CSVBox   -----            -----            IN 0/0
123456_PosWList_S1PubCSV  06/17/2008 13:25            06/17/2008 13:47            IN 0/0

again the same awk statement works fine for me ( how ever there are few extra spaces need to take care of)

TEST>awk 'NF==1 {p=$0;next} {$0=p$0;print;p=""}' rem.txt
123456_PosWListCSV                      -----            -----            IN 0/0
123456_PosWlist_S1CSVBox   -----            -----            IN 0/0
123456_PosWList_S1PubCSV                       06/17/2008 13:25                                           06/17/2008 13:47            IN 0/0