sc – SPREADSHEET CALCULATOR
Basic sc Usage in Command Mode
- hjkl — vi keys motion (or cursor keys).
- gB13 — go to cell B13.
- ir, ic — insert row, insert column.
- ma (mb, mc and so on) — “mark” cell as a (or b, or c and so on).
- ca (cb, cc and so on) — copy contents previously marked with ma.
- Ctrl-f, Ctrl-b — page up or down (also pgup, pgdown).
- dr, yr, pr — delete row, yank row, put row.
- dc, yc, pc — delete column, yank, put column.
- dd, yd, pd — delete, yank, put a cell.
- = — enter a numeric value (25 or F13-D14) or formula (@sum(A2:A145)).
- < — insert left-justified text.
- \ — insert centered text.
- > — insert right-justified text.
- x — remove cell.
- W<filename.asc> — write plain-text file.
- P<filename.sc> — write an .sc file.
- G<filename.sc> — read (“get”) an .sc file.
- Zr, Zc — zap (hide) row or column.
- sr, sc — show row or column.
- @ — force re-calculation.
- e — edit a numeric value.
- E — edit a string value.
- ? — help page
- Q — quit
- ^TC Color. This option enables color
- ^TN Color negative numbers. All cells containing negative numbers will have their color number incremented by one. Cells with color 8 will cycle back to color 1.
- ^A Go to cell A0 (same as HOME).
- Arrow Keys The terminal’s arrow keys provide another alternate set of cell cursor controls if they exist and are supported in the appropriate termcap entry.
- Move the cell cursor to row 0 of the current column.
- # Move the cell cursor down to the last valid row of the current column.
- 0 Move the cell cursor to column A.
- $ Move the cell cursor forward to the last valid column of the current row.
- g Go to a cell. sc prompts for a cell’s name or a number.
- mx Mark the current cell. sc will prompt for a lowercase letter to be used as a mark
- specifier. Marked cells may be used as the source for the c (copy a marked cell) command,
- or as the target of a ` or ‘ (go to marked cell) command.
- zc Center the current cell both horizontally and vertically.
- = Enter a numeric constant or expression into the current cell.
- < Enter a label string into the current cell to be flushed left against the left edge of the cell.
- \ Enter a label string into the current cell to be centered in the col- umn.
- > Enter a label string into the current cell to be flushed right against the right edge of the cell.
- { Left justify the string in the current cell.
- | Center the string in the current cell.
- } Right justify the string in the current cell.
- F Enter a format string into the current cell.
- # Digit placeholder.
- 0 Digit placeholder. Same as for `#’ except that the number is pad- ded with zeroes on either side of the decimal point.
- . Decimal point. Determines how many digits are placed on the right and left sides of the decimal point in the number.
- , Thousands separator. The presence of a `,’ in the format (multiple com- mas are treated as one) will cause the number to be formatted with a `,’ separating each set of three digits
- in the integer part of the number with numbering beginning from the right end of the integer.
- & Precision. When this character is present in the fractional part of the number, it is equivalent to a number of 0’s equal to the preci- sion specified in the column format command. For example, if the preci- sion is 3, `&’ is equivalent to `000′.
- \ Quote. This character causes the next character to be inserted into the formatted string directly with no special interpretation.
- E- E+ e- e+ Scientific format. Causes the number to be formatted in sci- entific notation. Some example formats are integer (“0 or “#), fixed (“0.00), percentage (“0% or “0.00%), scientific (“0.00E+00), and currency (“$#,0.00;($#,0.00)).
- e Edit the value associated with the current cell. This is identical to “= except that the command line starts out containing the old numeric value or expression associated with the cell. The editing in this mode is vi-like.
- ^H Move back a character
- ^V, v Enter navigate mode. This mode allows you to navigate the spread- sheet while editing a command. When in navigate mode, v will insert the numeric value of the current cell, if any, into the command line, instead, while ^V will return to the previous mode (like the ESCAPE key).
- ^W Insert the expression attached to the current cell into the command line. If there is none, the result is “?. This only works while in navi- gate mode.
- ^A In navigate mode, go to cell A0. When not in navigate mode, jump to the beginning of the line instead.
- ^E Jump to the end of the line. Unlike “$ (below), this can also be used from insert mode.
- 0 Goto column 0
- B Move back a word. Like b, except words are space delimited only.
- C Change to end of line (delete first, then enter insert mode)
- D Delete to end of line
- F Find the next char typed, moving backwards in the line
- G Go to the end of history, i.e., to the line being currently entered
- I Insert at column 0; ESC revert back to edit mode
- N Repeat the last search in the opposite direction
- P Insert the most recently deleted text before the cursor
- R Replace mode; ESC revert back to edit mode
- T Goto a char, moving backwards in the line
- W Forward a word. Like w, except words are space delimited only.
- X Delete the char to the left
- a Append after cursor; ESC revert back to edit mode
- b Move back a word
- c Change mode; ESC revert back to edit mode. In navigate mode, insert xolor range which includes the current cell.
- d Delete … 0 delete to beginning of line $ delete to end of line b back word e delete to end of word f forward (right) h back char l forward t delete forward up to a given char (next char typed) w delete next word forward
- e Forward to next end-of-word
- f Find the next char typed. In navigate mode, insert the outer frame range which includes the current cell.
- g In navigate mode, allows you to `goto’ a cell or range
- h Move left a char
- i Insert before cursor; ESC revert back to edit mode
- j Forward through history (same as +)
- k Backward through history (same as -)
- l Move right a char
- n Repeat the last search (find the next match)
- o When highlighting a range in navigate mode, move to the opposite corner of the highlighted range.
- p Insert the most recently deleted text after the cursor
- q Stop editing
- r Replace char.
- s Delete current char and enter insert mode (stands for substitute)
- t Goto a char
- u Undo
- w Forward a word
- x Delete the current char (moving to the right)
- y Copies to the delete buffer without deleting. Use like d (above).
- E Edit the string associated with the current cell.
- To enter and edit a cell’s number part, use the “=, “+, and e com- mands. To enter and edit a cell’s string part, use the “<, “\, “>, and E commands.
- ” Specify a named buffer for the next yank/delete/pull command. Buffers are named with a single character.
- x Clear the current cell. Deletes the numeric value, label string, and/or numeric or string expression.
- mx Mark the current cell. sc will prompt for a lowercase letter to be used as a mark specifier.
- cx Copy a marked cell to the current cell, adjusting row and column ref- erences in its numeric or string expression, if any.
- G Get a new database from a file. If encryption is enabled, the file is decrypted before it is loaded into the spreadsheet.
- P Put the current database into a file. If encryption is enabled, the file is encrypted before it is saved.
- ZZ Save the current database into a file if it has been modified, and then quit.
- W Write a listing of the current database into a file in a form that matches its appearance on the screen. This differs from the Put command in that its files are intended to be reloaded with Get, while Write produces a file for people to look at.
- T Write a listing of the current database to a file, but include delimit- ers suitable for processing by the tbl, LaTeX, or TeX table processors. The delimiters are controlled by the tblstyle option. See Set above. The delim- iters are a colon (:) for style 0 or tbl and an ampersand (&) for style latex or tex.
- With the Put, Write, and Table commands, the optional range argument writes a subset of the spreadsheet to the output file.
- The three output commands, Put, Write, and Table, can pipe their (unen- crypted only) output to a program. To use this feature, enter “| program to the prompt asking for a filename. For example, to redirect the output of the Write command to the printer, you might enter “| lpr -p.
- M Merge the database from the named file into the current database. Values and expressions defined in the named file are read into the current spreadsheet overwriting the existing entries at matching cell locations.
- ir, ic Insert a new row (column) by moving the row (column) containing the cell cursor, and all following rows (columns), down (right) one row (column). The new row (column) is empty. Inserting rows while the cell cur- sor is in a framed range will only effect rows in that range, leaving all rows to the left and right untouched.
- or, oc Open a new row (column). These commands work like the ir and ic commands, except that the new row (column) will be inserted after the cur- rent row (column) instead of before it.
- ar, ac Append a new row (column) immediately following the current row (column). It is initialized as a copy of the current one. Appending rows while the cell cursor is in a framed range will only effect rows in that range, leaving all rows to the left and right untouched.
- dr, dc, dd Delete the current row (column).
- yr, yc, yy Yank a copy of the current row (column) into the delete buffer without actually deleting it. yy yanks the current cell (similar to x, but without actually deleting the contents of the cell). Yanking rows while the cell cursor is in a framed range will only copy the portion of each row contained in that range, while ignoring everything outside the range.
- pr, pc, pp, pm, px, pt, pC, p. Pull deleted rows/columns/cells back into the spreadsheet. The last set of cells that was deleted or yanked is put back into the spreadsheet at the current location. pr inserts enough rows to hold the data. pc inserts enough columns to hold the data. pp (paste) does not insert rows or columns; it overwrites the cells beginning at the current cell cursor location. pm (merge) merges the cells in at the current cell cursor location, but does not erase the destination range first like pp. The difference between pp and pm is similar to the difference between the Get and Merge commands. pf (format) works like pm except that only cell formatting information is merged in, leaving the actual data untouched. This makes it easy to copy cell formats from one part of the spreadsheet to another, such as when expanding an existing spreadsheet file.
- px (exchange) copies the contents of the delete buffer into the range beginning at the current cell cursor location, while simultaneously copying the contents of this range back into the delete buffer, replacing its cur- rent contents. pt (transpose) overwrites the cells beginning at the current cell cursor location like pp, but transposes rows for columns and vice ver- sa. pC (copy) works like pp, except that all cell references are adjusted in the same way that they are for the copy command. p. is the same as pC, except that it switches to navigate mode and allows you to define the des- tination range to be used. This works like the copy command in that if the source range (the contents of the delete buffer) is a single row, column, or cell, multiple copies may be made.
- vr, vc, vv Remove expressions from the affected rows (columns)
- f Set the output format to be used for printing the numeric values in each cell in the current column. This command has only a column version (no second letter). You may change the column width by pressing the h, <, or cursor left key to reduce it, or the l, >, or cursor right key to increase it. Likewise, you may change the precision (the number of digits to follow decimal points) by pressing the j, -, or cursor down key to reduce it, or the k, +, or cursor up key to increase it. You may also change the format type for the column by pressing any digit.
- rx Clear a range. Cells cleared with this command will be saved in the delete buffer, and may be recalled with any of the pull commands.
- ry Yank a range. Like rx, cells yanked with this command will be saved in the delete buffer, and may be recalled with any of the pull commands.
- rc Copy a source range to a destination range. The source and destination may be different sizes. The result is always one or more full copies of the source. Copying a row to a row yields a row. Copying a column to a column yields a column. Copying a range to anything yields a range. Copying a row to a column or a column to a row yields a range with as many copies of the source as there are cells in the destination. This command can be used to duplicate a cell through an arbitrary range by making the source a single cell range such as b20:b20.
- rm Move a source range to a destination range.
- rv Values only. This command removes the expressions from a ange of cells, leaving just the values of the expressions.
- rs Sort a range. The rows in the specified range will be sorted according to criteria given in the form of a string of characters.
- rf Fill a range with constant values starting with a given value and in- creasing by a given increment. Each row is filled before moving on to the next row if row order recalculation is set. Column order fills each column in the range before moving on to the next column. The start and increment numbers may be positive or negative. To fill all cells with the same value, give an increment of zero.
- r{ Left justify all strings in the specified range.
- r} Right justify all strings in the specified range.
- r| Center all strings in the specified range.
- rC This command defines a color range, and specifies a foreground/back- ground pair to be used for that range.
- C This command first prompts you for the color number you would like to define (or redefine). After selecting a number (1-8), you may enter an ex- pression which defines the foreground and background colors. If the chosen color has previously been defined, the old definition will be presented for editing. The syntax of the color command is: color number = expression, where number is the number of the color pair you want to define, and ex- pression is the definition.
- rS This command shows lists of the currently defined range names, framed ranges, and color definitions and ranges, one after the other. The output of this command will be piped to less. If the environment variable PAGER is set, its value is used in place of less.
- @black red green yellow blue magenta cyan white
- color 1 = @white;@green will set the foreground color to white and the background color to green for any cell or range of cells defined to use color 1, or which have no color defined. If the semicolon operator is not used, and only one color is specified, that color will be used for the foreground, and the background will default to black.
- @ Recalculates the spreadsheet.
- Numeric Expressions
- -e Negation.
- e+e Addition.
- e-e Subtraction.
- e*e Multiplication.
- e/e Division.
- e1%e2 e1 mod e2.
- e^e Exponentiation.
- e<e e<=e e=e e!=e e>=e e>e Relationals: true (1) if and only if the indi- cated relation holds, else false (0).
- ~e Boolean operator NOT.
- e&e Boolean operator AND.
- e|e Boolean operator OR.
- @sum(r) Sum all valid (nonblank) entries in the region whose two corners are defined by the two variable names (e.g. c5:e14)
- @prod(r) @prod(r,e) Multiply together all valid (nonblank) entries in the specified region.
- @avg(r) @avg(r,e) Average all valid (nonblank) entries in the specified region.
- @count(r) Count all valid (nonblank) entries in the specified region.
- @stddev(r) @stddev(r,e) Return the sample standard deviation of the cells in the specified region.
- @rows(r) Return the number of rows in the specified range.
- @cols(r) Return the number of columns in the specified range.
- @sqrt(e) Return the square root of e.
- @exp(e) Return the exponential function of e.
- @ln(e) Return the natural logarithm of e.
- @log(e) Return the base 10 logarithm of e.
- @floor(e) Return the largest integer not greater than e.
- @ceil(e) Return the smallest integer not less than e.
- @rnd(e) Round e to the nearest integer. default:*.5 will be rounded up to the next integer; doing a ‘set rndtoeven’ will cause it to be rounded to the closest even number instead (aka banker’s round).
- @round(e,n) Round e to n decimal places. n may be positive to round off the right side of the decimal or negative to round off the left side.
- @abs(e) fabs(e) Return the absolute value of e.
- @pow(e1,e2) Return e1 raised to the power of e2.
- @hypot(e1,e2) Return sqrt(e1*e1+e2*e2), taking precautions against un- warranted overflows.
- @pi A constant quite close to pi.
- @dtr(e) Convert e in degrees to radians.
- @rtd(e) Convert e in radians to degrees.
- @asin(e) Return the arc sine of e in the range -pi/2 to pi/2.
- @acos(e) Return the arc cosine of e in the range 0 to pi.
- @atan(e) Return the arc tangent of e in the range -pi/2 to pi/2.
- @atan2(e1,e2) Returns the arc tangent of e1/e2 in the range -pi to pi.
- @max(e1,e2,…) Return the maximum of the values of the expressions.
- @min(e1,e2,…) Return the minimum of the values of the expressions.
- @ston(se) Convert string expression se to a numeric value.
- @eqs(se1,se2) Return 1 if string expression se1 has the same value as string expression se2, 0 otherwise.
- @nval(se,e) Return the numeric value of a cell selected by name.