Next: , Previous: , Up: Inserting Records   [Contents][Index]

4.1.2 Replacing Records With recins

recins can also be used to replace existing records in a database with a provided record. This is done by specifying some criteria selecting the record (or records) to be replaced.

Consider for example the following command applied to our contacts database:

$ recins -e "Email = 'foo@bar.baz'" -f Name -v "Mr. Foo" \
    -f Email -v "new@bar.baz" contacts.rec

The contact featuring an email foo@bar.baz gets replaced with the following record:

Name: Mr. Foo
Email: new@bar.baz

The records to be replaced can also be specified by index, or a range of indexes. For example, the following command replaces the first, second and third records in a database with dummy records:

$ recins -n 0,1-2 -f Dummy -v XXX foo.rec
$ cat foo.rec
Dummy: XXX

Dummy: XXX

Dummy: XXX

... Other records ...