greycat 1186172388 learn Unix sed has no -i flag. Only GNU sed 4.x does. You can use ed or perl to edit files in-place in portable scripts. See for s///. For /foo/d you can use perl -ni -e 'print unless /foo/' * greycat 1211396450 forget greycat 1211396454 learn Unix sed has no -i flag. You can use perl or ed to edit files in-place in portable scripts. See http://wooledge.org/mywiki/BashFAQ/021 or /msg greybot ed kojiro 1232666460 forget kojiro 1232666549 learn A common request is how to write to the same file as the one you read. "sed -i" is a potential solution, but keep in mind the -i flag to sed is nonstandard and not portable. If in doubt, use a temp file. kojiro 1232666579 forget kojiro 1232666622 learn A common request is how to write to the same file as the one you read. "sed -i" is a potential solution, but keep in mind the -i flag to sed is nonstandard and not portable. If in doubt, use a temp file. See !faq 21 and ask me about ed. lhunath 1322562021 forget lhunath 1322562321 learn Some sed(1)s have a -i flag that allow you to "modify" files. Sed is NOT A FILE EDITOR: its -i flag does not edit a file, it deletes and re-writes it. This has many problems, including breaking open handles and symlinks. Worse, -i usage is very unportable: your command can do very bad things on other systems. Use ed(1), vi(1) or ex(1) instead! lhunath 1322563069 forget lhunath 1322563080 learn Some sed(1)s have a -i flag that allow you to "modify" files. Sed is NOT A FILE EDITOR: its -i flag does not edit a file, it deletes and re-writes it. This has many problems, including breaking open handles and symlinks. Worse, -i usage is very unportable: your command can break or do bad things on other systems. Use ed(1), vi(1) or ex(1) instead! lhunath 1384355806 forget lhunath 1384356427 learn Some sed(1)s have a -i flag that claims to "modify" files. It does not: sed is NOT A FILE editor, its -i flag re-writes the entire file and then replaces the original with the new. This causes problems, including breaking open handles and symlinks. Worse, -i is very unportable: a valid sed on one system will write broken files on another. Use ed(1), vi(1) or ex(1) instead: eg. ex -sc '%s/a/b/|wq' lhunath 1384356532 forget lhunath 1384356821 learn Some sed(1)s have -i which claims to "modify" files. It does not: sed is not a FILE editor; its -i flag re-writes the entire file and replaces the original with the new. This breaks open handles, symlinks and more. -i is also unportable: valid sed on one system will write broken files on another. Use ed(1) or ex(1) instead: eg. ex -sc '%s/a/b/|wq' file greycat 1410461343 forget greycat 1410461344 learn Some sed(1)s have -i which claims to "modify" files. It does not: sed is not a FILE editor. The -i flag re-writes the entire file and replaces the original with the new. This breaks open handles and hard-link sets, and fails to follow symlinks. -i is also unportable: valid sed on one system will write broken files on another. Use ed(1) or ex(1) instead: eg. ex -sc '%s/a/b/|wq' file greycat 1619644644 forget greycat 1619644645 learn sed -i isn't portable; standard sed doesn't have it at all, GNU sed -i has an optional argument, and BSD sed -i has a mandatory argument. See !editing and for advice on modifying files. izabera 1641482129 forget izabera 1641482161 learn sed -i isn't portable; standard sed doesn't have it at all, GNU sed -i has an optional argument, and BSD sed -i has a mandatory argument. See !editing and for advice on modifying files. izabera 1641482199 forget izabera 1641482262 learn sed -i isn't portable; standard sed doesn't have it at all, GNU sed -i has an optional argument, and BSD sed -i has a mandatory argument. See !editing and for advice izabera 1641482626 forget kurahaupo 1641483320 learn sed -i isn't portable; standard sed doesn't have it at all, GNU sed -i has an optional argument, and BSD sed -i has a mandatory argument. See !editing and for advice