Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Commit

Permalink
feat: sed match pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
ASuciuX committed Nov 30, 2023
1 parent 717f2ce commit acdac59
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions mutation-testing/scripts/sed-script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

FILE="../packages-output/stx-genesis/caught.txt"

var_1="stx-genesis/src/lib.rs"
var_2="replace <impl Iterator for LinePairReader>::next -> Option<Self::Item> with Some(Default::default())"

# Escape the variables for use in a sed pattern
escaped_var_1=$(echo "$var_1" | sed -E 's/([][\/$*.^|])/\\&/g')
escaped_var_2=$(echo "$var_2" | sed -E 's/([][\/$*.^|])/\\&/g')

# Use sed to remove lines matching the pattern
sed "/$escaped_var_1:[0-9]+:$escaped_var_2/d" "$FILE" > "$FILE"
# :[0-9]+:
# sed -i "/$regex/d" "$FILE"

0 comments on commit acdac59

Please sign in to comment.