I am removing duplicated lines of text from a number of files. The command I am trying to use issed -i 's/set autologout=10//g' /home/$x/.loginWhen I run it, I get this error sed: -I or -i may not be used with stdinThe command runs successfully without the -i option however it doesn't save it. I am scripting this out as I am modifying 2 files per account on each server. I can code this out with one ugly exception, I can't get it to save.
Remove text from a file and save, without opening
sed;files;editors
What @don_crissti's comment refers, is the fact that BSD sed seems to require an argument for -i, and if -e isn't used, the first argument is taken as the sed command. Which leaves none for the input file, defaulting to stdin, and you can't edit that in-place.That's as opposed to, say, GNU sed, which has -i take an optional argument.Or in other words, your sed may be interpreting the s/set autologout=10//g as a parameter to -i, the extension to use for the backup file. So if you don't want to leave a backup file, just give the -i option an empty argument:sed -i  's/set autologout=10//g' /home/$x/.login