1752571 Members
5246 Online
108788 Solutions
New Discussion юеВ

merge 2 lines in 1 line

 
SOLVED
Go to solution
erich hummel_1
Advisor

merge 2 lines in 1 line

my problem is to merge 2 lines from a file in 1 line.
the file is follow built and has 2000 entries:

R3:00141.80kW;89
07:52:33 19.11.2005

R3:00199.90kW;97
07:58:43 19.11.2005

R3:00184.98kW;99
08:04:43 19.11.2005

......

and it should look like:
R3:00141.80kW;89;07:52:33 19.11.2005
R3:00199.90kW;97;07:58:43 19.11.2005
........


how can i do this in a script ?

TX Eric
3 REPLIES 3
Hemmetter
Esteemed Contributor
Solution

Re: merge 2 lines in 1 line

Hi (Servus) Eric

Your can do it like this:

cat /tmp/a.file | while read L1; do
read L2
read emptyline
echo "$L1;$L2"
done

rgds
hgh
erich hummel_1
Advisor

Re: merge 2 lines in 1 line

Hallo Hemmetter

funktioniert super, Recht herzlichen Dank f├Г┬╝r deine Hilfe.

Gru├Г nach Germany
erich hummel_1
Advisor

Re: merge 2 lines in 1 line

close question - the answer from Hemmetter works very good.

TX Eric