Browse Source

added lineinfile

master
Mario Alegre 5 years ago
parent
commit
b994e1b854
  1. 5
      docs/linux/bash/lineinfile.sh

5
docs/linux/bash/lineinfile.sh

@ -0,0 +1,5 @@
#!/bin/bash
line=${1:?}
regex=${2:-1}
sed -E -e "/$regex/{s/.*/$line/;:a;n;ba;q}" -e "\$a $line"
Loading…
Cancel
Save