shell - How can I replace a specific line of a file in bash script? -
i have file inside 1 directory, want replace 1 specific line line.
in case line - "password requisite pam_pwquality.so" , want make as
"#password requisite pam_pwquality.so".
i tried this:
cat test1 | while read line if grep -q "$str" test1; echo "found" sed -i -e "s/${str}/${str1}/g" test1 fi
but showing multiple found statements having 1 copy of line.
$ x='password requisite pam_pwquality.so' $ sed -i "s/\($x\)/#\1/" file
Comments
Post a Comment