Next: , Previous: Adding Fields, Up: Editing Fields

5.2 Setting Fields

It is also possible to update the value of a field. This is done using recset with its -s flag. In the previous example, an `Inspected' flag was added to certain records, with the value `yes'. After reflection, one might want to record the date of inspection, rather than a simple yes/no flag. Records which have no such field will remain unchanged.

     $ recset -t Item -f Inspected -s '30 October 2006' stock.rec

Although the above command does not have any selection criteria, it will only affect those records for which a `Inspected' field exists. This is because the -s flag only sets values of existing fields. It will not create any fields.

If instead the -S flag is used, this will create the field (if it does not already exist) and set its value.

     $ recset -t Item -f Inspected -S '30 October 2006' stock.rec