I have a text file that has lines like:
LIN This is the value which I need
from this line which has a very long line
SHR This1;This2;
This3;
GYC This is an extra.
And the output is supposed to be as:
LIN This is the value which I need from this line whi a very..
SHR This1;This2;This3;
GYC This is an extra.
I was trying this in sed
first before I could do it in Python. So I managed to come up with..
sed 's/ //' filename.txt
The above snippet does only one thing, it removes the empty 4+1 spaces (always fixed), however now i am stuck not sure knowing how to go ahead with because I have to move the lines to the LINE&SHRT tags so i am able to extract information. Also, when the tag line ( with LINE/SHRT/EKY/EKC/USER) line is continuing it gets indicated by a single extra space. And if supposed to be new line then it continues to next line.
Question, can sed be used to move the line to previous line? How can i differentiate the empty space to indicate if line is carry on or terminates