From Nagios I downloaded its html file by using wget command and then I converted that htmlfile to Textfile by using following code:
html2text -width 180 file.html >a.txt
then I cut the first 10 lines becoz I dont want that text and I got below textfile output
awk 'NR > 10 { print }'a.txt > b.txt
I have to merge two rows into single row not for all lines only for particular output from b.txt file. Note: the text file contains N number of lines
Here the b.txt File Output:
DISK OK - free space: CRITICAL
01-08-2018 07:05:05 Service Required Critical CPU:loadaverage 6.0%
01-08-2018 07:10:25 Service Alert Critical memoryUsage
DISK OK - free space:
02-08-2018 01:05:2018 Service Alert Warning memoryUsage
CRITICAl:outstanding alert attention
02-08-2018 02:05:2018 Service Alert Critical required
Expected output:
01-08-2018 07:05:05 DISK OK - free space:Service Required Critical CRITICALservice requiredCPU:loadaverage 6.0%
01-08-2018 07:10:25 Service Alert Critical memoryUsage
02-08-201801:05:2018 DISK OK - free space:Service Alert Warning memoryUsage
02-08-2018 02:05:2018 Service Alert Critical CRITICAL:outstanding alert attention required
Thanks in advance
You can use awk to merge lines together: