Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Better ( rm foo; bar > foo ) < foo ?



> TMPFILE=$(mktemp "$(dirname "$FILE")/XXXXXX") || exit 1
> sed 's/foo/bar/g' < "$FILE" > "$TMPFILE" || { rm -f "$TMPFILE" ; exit 1 }
> mv "$TMPFILE" "$FILE"

I find that

perl -pi -e 's/foo/bar/g' $FILE

is much less of a hassle, if that's the complexity you're dealing with.



Messages sorted by: Reverse Date, Date, Thread, Author