read one character from the input-stream.
read; print; clear;
The script above reads the <stdin> and prints each
character to <stdout> and then deletes that character from the
workspace text buffer and loops back to the first read command. This
very simple (the simplest) script demonstrates the implicit loop that the Nom
language employs, which is similar to
SED and [awk]. In the case of
SED
and
AWK however, the loop is a line-by-line loop, but in Nom the script
writer can determine if he or she wishes to parse character-by-character,
word-by-word, line-by-line (using while
whilenot
or until
)
or any other way that he or she sees fit.
This is potentially the most important command in the nom language. Without read nom could do nothing. Read is also important because it makes the pep&nom system character-based rather than line-based. A lot of traditional UNIX tools use a line-based approach to filtering text. But reading a text-file line-by-line impedes the proper parsing of the context-free language structures in the text.
The read command reads one character from the input stream and places that character in the 'peep' buffer. The character which was in the peep buffer is added to the end of the 'workspace' buffer.
The read command is the fundamental mechanism by which the input stream is “tokenized", which is also known as” lexical analysis". The commands which also perform tokenisation are “until",” while" and “whilenot". These” commands perform implicit “read” operations.
There is no implicit read command at the beginning of a script (unlike “sed” ), so all scripts will probably need at least one read command.