Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Parsing Output of strace Command

Does anyone have experience or working code that parses the output of strace command?

Copilot can up with this but is does not work ...

 

let
// Function to parse a single line of strace output
ParseStraceLine = (line as text) as record =>
let
// Find the position of the first parenthesis
openParen = List.First(Text.PositionOf(line, "(", Occurrence.First)),
// Find the position of the last parenthesis
closeParen = List.First(Text.PositionOf(line, ")", Occurrence.First, openParen)),
// Extract the syscall name
syscall = if openParen > 0 then Text.Start(line, openParen) else null,
// Extract the arguments
args = if openParen > 0 and closeParen > openParen then Text.Middle(line, openParen + 1, closeParen - openParen - 1) else null,
// Extract the result
resultStart = List.First(Text.PositionOf(line, "=", Occurrence.First, closeParen)) + 2,
result = if resultStart > 1 then Text.Middle(line, resultStart) else null,
// Create a record with the parsed data
parsedRecord = if syscall <> null and args <> null and result <> null then
[Syscall = syscall, Args = args, Result = result]
else
null
in
parsedRecord,

// Load the strace output from a text file
Source = Text.FromBinary(File.Contents("strace_output.txt")),
Lines = Text.Split(Source, "#(lf)"),

// Parse each line and filter out null values
ParsedLines = List.Transform(Lines, each ParseStraceLine(_)),
FilteredLines = List.Select(ParsedLines, each _ <> null),

// Convert the list of records to a table
Table = Table.FromRecords(FilteredLines)
in
Table

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Powerquery does not have a built-in m function for parsing strace results. It is difficult to parse strace results directly using powerquery, so try to process them upstream before pulling them into powerquery.

parsing - How to parse strace in shell into plain text? - Stack Overflow

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Anonymous ,

 

Powerquery does not have a built-in m function for parsing strace results. It is difficult to parse strace results directly using powerquery, so try to process them upstream before pulling them into powerquery.

parsing - How to parse strace in shell into plain text? - Stack Overflow

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors