On Mon, Nov 20, 2006 at 09:15:18PM +0100, Geert Stappers wrote:
Op 20-11-2006 om 20:57 schreef Geert Stappers:Op 19-11-2006 om 22:37 schreef Martin Michlmayr: sed -i 's/\(:[^:]*:\)[0-9]*/\1/' /target/etc/shadow >From the manual of sed: -i[SUFFIX], --in-place[=SUFFIX] edit files in place (makes backup if extension supplied)I don't know if it works in busybox or the sed that d-i uses.
It does work in d-i's sed...and it preserves permissions: ~ # echo "apple banana orange" > test.txt ~ # ls -al test.txt -rw-r--r-- 1 root root 17 Nov 20 21:32 test.txt ~ # chmod 0600 test.txt ~ # ls -al test.txt -rw------- 1 root root 17 Nov 20 21:32 test.txt ~ # sed -i 's/banana/pear/' test.txt ~ # cat test.txt apple pear orange ~ # ls -al test.txt -rw------- 1 root root 17 Nov 20 21:32 test.txt -- David Härdeman