Target file
January 10, 2026 · View on GitHub
#!/bin/bash
Target file
FILE="/Users/vemv/.nvm/versions/node/v23.11.0/bin/claude"
Check if file exists
if [ ! -f "FILE" exit 1 fi
Pattern to search for - looking for an array containing at least 5 of these words
This makes it more robust to changes in the word list
PATTERN='words:["[^]]"Accomplishing"[^]]"Clauding"[^]]"Cogitating"[^]]"Pondering"[^]]"Wrangling"[^]]]'
Count matches
MATCH_COUNT=PATTERN" "$FILE" | wc -l | tr -d ' ')
echo "Found $MATCH_COUNT match(es) using pattern 1"
If pattern 1 doesn't work, try a more flexible pattern
if [ "MATCH_COUNT" -eq 0 ]; then # Try looking for array with at least 3 key words (order doesn't matter) PATTERN2='words:\[\("[^"]*",\)*"[^"]*\(Accomplishing\|Clauding\|Cogitating\|Pondering\|Thinking\|Wrangling\)[^]]*\]' MATCH_COUNT=(grep -E -o 'words:[[^]]("Accomplishing"|"Clauding"|"Cogitating")[^]]("Pondering"|"Thinking"|"Wrangling")[^]]*]' "FILE" | wc -l | tr -d ' ') echo "Found MATCH_COUNT match(es) using pattern 2" fi
if [ "MATCH_COUNT" -gt 1 ]; then echo "Error: Multiple matching arrays found. Aborting to avoid unintended changes." exit 1 fi
echo "Exactly one match found. Proceeding with replacement..."
Use perl for more reliable replacement
Find Ku6={words:[...]} and replace the array content with [""]
perl -i -0777 -pe 's/(Ku6={words:)[[^]]("Accomplishing"|"Clauding"|"Cogitating")[^]]("Pondering"|"Thinking"|"Wrangling")[^]]*]/FILE"
echo "Replacement complete!"