I have output from a firewall configuration that contains lines with data in a specific format. I need to transform this data for a spreadsheet to split groups of 4 columns from each line into a new, while retaining the first and last delimited fields of the line from which it came, then removing the first line.
I've attempted to use awk, ed, rs, tr, and can't seem to figure out how to properly do this. Each line is a different length, but the fields will always be a group of 4 starting at the second delimited field. So fields 2,3,4,5; 6,7,8,9; 10,11,12,13; 14,15,16,17, etc... length of lines could be up to 128 fields
The data i'm attempting to transform looks as follows
startoflinesampletext_25;10.2.8.13;25;10.2.8.13%2;25;10.2.8.14;25;10.2.8.14%2;25;10.2.8.15;25;10.2.8.15%2;25;10.2.8.56;25;10.2.8.56%2;25;10.2.8.57;25;10.2.8.57%2;25;endoflinesampletext
The expected result I'm hoping for would look like this :
startoflinesampletext_25;10.2.8.13;25;10.2.8.13%2;25;endoflinesampletext
startoflinesampletext_25;10.2.8.14;25;10.2.8.14%2;25;endoflinesampletext
startoflinesampletext_25;10.2.8.15;25;10.2.8.15%2;25;endoflinesampletext
startoflinesampletext_25;10.2.8.56;25;10.2.8.56%2;25;endoflinesampletext
startoflinesampletext_25;10.2.8.57;25;10.2.8.57%2;25;endoflinesampletext
awkto the rescue!note that there is no validation that the fields are multiple of four.