Reputation: 45
I would explain my issue but it is easier just to paste the code
test.sh
sed -i '/192.168.1.1/d' *
I want it to exclude itself in this search, how would I go about doing that?
Upvotes: 0
Views: 66
Reputation: 532418
The simplest solution is to use bash
's extended pattern syntax.
shopt -s extglob
sed -i '/192.168.1.1/d' !(test.sh)
The pattern !(test.sh)
matches everything except test.sh
.
Upvotes: 4