Skip to content

Instantly share code, notes, and snippets.

@skurhse
Last active April 30, 2025 04:17
Show Gist options
  • Save skurhse/90fa408e3b23f69d026d25c56ba4af7d to your computer and use it in GitHub Desktop.
Save skurhse/90fa408e3b23f69d026d25c56ba4af7d to your computer and use it in GitHub Desktop.
set -o xtrace
v=(a/b b/c d)
echo 'a/b b/c d
a/b b/c
a/b/b/cd' > /tmp/test.txt
cp /tmp/test{,2}.txt
# 1:
sed -i "/${v[*]//\//\\/}/d" /tmp/test.txt
# 2:
mv /tmp/test2.txt{,.bk}
while read -r line
do
[[ ! $line == ${v[*]} ]] && echo "$line"
done </tmp/test2.txt.bk >/tmp/test2.txt
cmp /tmp/test{,2}.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment