From 2c42d35e5065773d4f3cf4cf1ce334113ad89a18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikel=20Brostr=C3=B6m?= Date: Thu, 19 Sep 2024 08:11:09 +0200 Subject: [PATCH] simplify table replacement --- .github/workflows/benchmark.yml | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 774a591e9..ac5030121 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -174,25 +174,12 @@ jobs: start_marker="" end_marker="" + # Use awk to replace lines between markers, preserving non-table content # Use awk to replace lines between markers, preserving non-table content awk -v start_marker="$start_marker" -v end_marker="$end_marker" -v new_table="$new_table" ' - BEGIN { in_table=0 } - { - if ($0 == start_marker) { - print $0 # Print the start marker - print new_table # Insert the new table - in_table=1 # Start skipping lines in the old table - next - } - else if ($0 == end_marker) { - in_table=0 # End skipping when reaching end_marker - print $0 # Print end marker - next - } - if (!in_table) { - print $0 # Continue printing lines outside the table - } - } + $0 == start_marker { print $0; print new_table; in_table=1; next } + $0 == end_marker { in_table=0; print $0; next } + !in_table ' "$README_FILE" > temp_readme.md # Replace original README with updated version