Source = Table.FromColumns({Lines.FromBinary(File.Contents("c:\Users\user\Downloads\216.162.47.76.txt"), null, null, 1251)}),
#"Added Conditional Column" = Table.AddColumn(Source, "gr", each if Text.Contains([Column1], "value") then 1 else
if Text.Contains([Column1], "handle") then 2 else if Text.Contains([Column1], "startAddress") then 3 else if
Text.Contains([Column1], "endAddress") then 4 else if Text.Contains([Column1], "name") then 5 else if
Text.Contains([Column1], "country") then 6 else if Text.Contains([Column1], "description") then 7 else if
Text.Contains([Column1], "eventDate") then 8 else if Text.Contains([Column1], "label") then 9 else null),
#"Filtered Rows" = Table.SelectRows(#"Added Conditional Column", each [gr] <> null and [gr] <> ""),
#"Grouped Rows" = Table.Group(#"Filtered Rows", {"gr"}, {{"a", each _, type table}}),
#"Added Conditional Column2" = Table.AddColumn(#"Grouped Rows", "b", each if [gr] <> 7 and [gr] <> 2 then Table.FirstN([a],1) else [a]),
#"Changed Type" = Table.TransformColumns(#"Added Conditional Column2",{{"b", each Table.AddIndexColumn(_, "Индекс", 1)}}),
#"Sorted Rows" = Table.Sort(#"Changed Type",{{"gr", Order.Ascending}})[[b]],
#"Expanded {0}" = Table.ExpandTableColumn(#"Sorted Rows", "b", {"Column1", "Индекс"}, {"Column1", "Индекс"}),
#"Split Column by Delimiter" = Table.SplitColumn(#"Expanded {0}", "Column1", Splitter.SplitTextByEachDelimiter({":"},
QuoteStyle.Csv, false), {"Column1.1", "Column1.2"}),
#"Merged Columns" = Table.CombineColumns(Table.TransformColumnTypes(#"Split Column by Delimiter", {{"Индекс", type text}},
"ru-RU"),{"Column1.1", "Индекс"},Combiner.CombineTextByDelimiter("_", QuoteStyle.None),"Сведено"),
#"Added Conditional Column1" = Table.AddColumn(#"Merged Columns", "a", each if Text.End([Column1.2],1)="," then
Text.BeforeDelimiter([Column1.2], ",", {0, RelativePosition.FromEnd}) else [Column1.2])[[Сведено],[a]],
#"Pivoted Column" = Table.Pivot(#"Added Conditional Column1", List.Distinct(#"Added Conditional Column1"[Сведено]), "Сведено", "a")
in
#"Pivoted Column"
|