Hi ,
I have the below source
source data
1|2|3|:123:abc|4
1|2|a| | 5
1|2|3|4|:a:s:D.....:n|t
Target data should be
1|2|3|:123:abc|4
1|2|3|:123:abc|4
1|2|a| | 5
1|2|3|4|:a:s:D.....:n|t
1|2|3|4|:a:s:D.....:n|t
1|2|3|4|:a:s:D.....:n|t
1|2|3|4|:a:s:D.....:n|t
based on the 5th column : I should print the same record..so I i have 2 :'s i have to print the record two times..if I have 5 :'s I have to print it 5 times so on
I got the below code from this forum
awk -F"|" '{s=gsub(":",":",$6); for(i=1;i<=s+1;i++) print $0}' OFS="|" input_file
The code is splitting the records based on : , but it is removing all the rows with non :..I need to include those rows as well.
can any one tweak this code to include all the rows plus creating multiple records based on :
--Mora