I've a CSV file with the following format (;
is the delimiter):
KEY;..;..;..;..;id1;..;..
SUBKEY;..;..
SUBKEY;..;..
SUBKEY;..;..
KEY;..;..;..;..;id2;..;..
SUBKEY;..;..
SUBKEY;..;..
SUBKEY;..;..
I need to take the id
(6th column) from each line starting with KEY
then append it to the following rows starting with SUBKEY
. So the result should be something like this:
SUBKEY;..;..;id1
SUBKEY;..;..;id1
SUBKEY;..;..;id1
SUBKEY;..;..;id2
SUBKEY;..;..;id2
SUBKEY;..;..;id2
Any idea how this can be done in bash script?