Avatar of aixtutorial
aixtutorial
Flag for United States of America asked on

This is AIX5.3..need a shell script or perl script

I have a text file which is as below
cat output.txt
./Work_0134_140755167.log
work      Dev      ab      da026:0      2012-09-24 00:00:13      Secondary Assignment
./Work_0134_140755168.log
work      Dev      ab      db086:0      2012-09-24 00:00:11     Authority Limit
work      Dev      ab      db086:0      2012-09-24 00:00:11      Value Process
./Work_0134_140755169.log
work      Dev      ab      da026:0      2012-09-24 00:00:16      Internal Alerts
./Mgr_0134_140755170.log
work      Dev      ab      da026:0      2012-09-24 00:00:17      Internal Alerts
./Work_0134_140755171.log
'
'

but I want the output to be as below..The log file in the ouput.txt should gte appended to the first line below until the occurance of next log file and it should be the same


./Work_0134_140755167.log work      Dev      ab      da026:0      2012-09-24 00:00:13      Secondary Assignment

./Work_0134_140755168.log work      Dev      ab      db086:0      2012-09-24 00:00:11     Authority Limit
./Work_0134_140755168.log work      Dev      ab      db086:0      2012-09-24 00:00:11      Value Process

./Work_0134_140755169.log work      Dev      ab      da026:0      2012-09-24 00:00:16      Internal Alerts

./Mgr_0134_140755170.log work      Dev      ab      da026:0      2012-09-24 00:00:17      Internal Alerts
./Work_0134_140755171.log

'
'
'
Unix OSLinux

Avatar of undefined
Last Comment
aixtutorial

8/22/2022 - Mon
woolmilkporc

awk '{if($0~"^\./") {PREF=$0;p=0} else {print PREF,$0;p=1}} END {if(p==0) print PREF}' output.txt
ASKER CERTIFIED SOLUTION
woolmilkporc

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
aixtutorial

ASKER
As always..Thanks a lot wmp.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes