Browse Source

fix: append_or_replace tabulation grep -P

master
pvincent 3 years ago
parent
commit
258a035fd1
  1. 4
      tools/append_or_replace

4
tools/append_or_replace

@ -13,8 +13,8 @@ REGEX=$1
STRING=$2
FILE=$3
if ! grep -q "$REGEX" "$FILE"; then
PREFIX="" echo "$STRING" >>$FILE
if ! grep -Pq "$REGEX" "$FILE"; then
printf "$STRING\n" >>$FILE
echo appended
else
sed -i "s|$REGEX|$STRING|g" $FILE

Loading…
Cancel
Save