Not sure I understand correctly what you're after. Given you have multiple spaces between fields and just single spaces within fields, you could try setting the field separator to multiple spaces:
It's absolutely non-trivial to deal with empty fields when field separators are multiple spaces, and your sample does NOT have six spaces as separators but any number, some six or larger. Try
Code:
awk -F" +" '
NR == 1 {gsub (/#/, _)
n = split ($0, HD)
next
}
NF < 5 {$(NF+1) = $NF
$(NF-1) = ""
}
{for (i=1; i<=n; i++) print HD[i], "=", $i
}
' file
server = qvipar
process = opcmsga
description = OVO Message Agent
type = AGENT,EA
status = Aborted
server = qvipbc
process = opcmsga
description = OVO Message Agent
type = AGENT,EA
status = Aborted
server = qvipca
process = perfalarm
description = Alarm generator
type =
status = Stopped
server = qvipbd
process = opcmsga
description = OVO Message Agent
type = AGENT,EA
status = Aborted
Hi Experts,
In short : Need to split file when field in column 5 is blank and need to generate two file in which column 5 is blank and other in which column 5 has values along with other rows and column data
My issue is i am not able to get header for column from raw file into new file which... (4 Replies)
Dear All,
In a CSV file, say that a given column has been extracted. In that column, information is missing (i.e. blank lines appear). I would like to replace the blank lines by the last valid line (not blank) previously read.
For example, consider the extract below:
123
234
543
111... (7 Replies)
Hi All
Need Help
I have a file with the below format (ABC.TXT) :
®¿¿ABCDHEJJSJJ|XCBJSKK01|M|7348974982790
HDFLJDKJSKJ|KJALKSD02|M|7378439274898
KJHSAJKHHJJ|LJDSAJKK03|F|9898982039999
(cont......)
I need to write a script where it will check for : blank lines (between rows,before... (6 Replies)
Hello All ,
I have a file which needs to split based on the blank lines
Name ABC
Address London
Age 32
(4 blank new line)
Name DEF
Address London
Age 30
(4 blank new line)
Name DEF
Address London (8 Replies)
Hi,
Consider a file named "testfile"
The contents of file are as below
first line added for test
second line added for test
third line added for test
fourth line added for test
fifth line added for test (5 Replies)
Dear All-
Please suggest a single unix command which can append blank line in multiple files.
I need to achieve this using a single unix command and not a script
Please do advice
Regards,
Suresh (2 Replies)
Hi Guru's , I have a whole bunch of files in /var/tmp that i need to strip any blank lines from, so ive written the following script to identify the lines (which works perfectly).. but i wanted to know, how can I actually strip the identified lines from the actual source files ??
my... (11 Replies)
hi all
I want to get multiple search that are separated by blank line according to first search in text file
eg: egrep 'x|Y|Z' file
in that for each x...it should be seperated by blank line
will u pls help (8 Replies)
can't figure out a way to delete multiple empty lines but keep single empty lines in a file, file is like this
#cat file
1
2
3
4
5
6
-
What I want is
1
2 (6 Replies)