recins adds new records to a rec file or to rec data read
from the standard input. Synopsis:
recins [option]... [t type] [-n indexes | -e record_expr | -q str | -m num] \
[(-f str -v str]|[-r recdata)]... [file]
The new record that will be inserted by the command is constructed by
using pairs of ‘-f’ and ‘-v’ options. Each pair defines a
field. The order of the parameters is significant.
If no file is specified then the command acts like a filter, getting
the data from the standard input and writing the result in the
If the specified file does not exist, it is created.
In addition to the common options described earlier (see Common Options) the program accepts the following options.
- The type of the new record. If there is a record set in the input
data matching this type then the new record is added there. Otherwise
a new record set is created. If this parameter is not specified then
the new record is anonymous.
- Declares the name of a field. This option shall be followed by a
- The value of the field being defined.
- Add the fields of the record in value. This option can be
intermixed with -f ... -v pairs.
- Encrypt confidential fields with the given password.
- Don't use external record descriptors.
- Be verbose when reporting integrity problems.
- Don't generate auto fields. See Auto-Generated Fields.
Record selection arguments are supported too. If they are used
then recins enters “replacement mode”. Instead of
appending the new record, matched records are replaced by copies of
the provided record. The selection arguments are summarized in the
- ‘-n indexes’
- Match the records occupying the given positions in its record set.
indexes must be a comma-separated list of numbers or ranges, the
ranges being two numbers separated with dashes. For example, the
following list denotes the first, the third, the fourth and all
records up to the tenth:
- ‘-e record_expr’
- A record selection expression (see Selection Expressions).
Matching records will get replaced.
- ‘-q str’
- Remove records having a field whose value contains the substring
- ‘-m num’
- Select num random records. If num is zero then all
records are selected, i.e. no replace mode is activated.
- Make strings case-insensitive in selection expressions.
- Insert the requested record even in potentially dangerous situations,
such as when the data integrity of the database is compromised.