All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
The 'acol' Command-line Utility
O2scl contains a command-line utility, acol, designed to facilitate the manipulation of two-dimensional data tables, either stored in a generic text-file, or o2scl::table objects stored using the I/O facilities in O2scl .

acol has a command, run, which allows you to run a set of commands which are given in a separate file. An example script in the extras directory of the documentation is named acol.scr. The associated output is a useful demonstration of the capabilities of acol.

#
# ------------------------------------------------------------
# This file documents the use of the 'acol' command.
# There is a generic help command:
# ------------------------------------------------------------
Running command: help
acol: A data table viewing and processing program for O2scl_ext.

List of commands:

alias       Create a command alias.                                 
assign      Assign a constant, e.g. -a hc=197.33                    
binary      Output to a file in internal binary format.             
calc        Compute the value of a constant expression.             
commands    Output the list of commands.                            
create      Create a table from uniform grid.                       
delete-col  Delete a column.                                        
delete-rows Delete rows.                                            
deriv       The derivative of a function specified by two columns   
deriv2      Second derivative.                                      
exit        Exit (synonymous with 'quit').                          
file        Read a table from a file.                               
find-row    Find a row.                                             
fit         Fit two columns to a formula.                           
formula     Create a new column from a formula.                     
generic     Read in a generic data file                             
get         Get the value of a parameter.                           
get-row     Get a row by index.                                     
help        Show help information.                                  
html        Create a file in HTML                                   
index       Output row numbers, defining the column 'N'.            
insert      Interpolate a column from another file                  
insert-full Interpolate a table from another file                   
integ       Integrate a function specified by two columns.          
internal    Output in the internal text format.                     
interp      Interpolate a number into a column.                     
license     Show license information.                               
list        List the constants, column names and the number of rows.
max         Find the maximum value of a column.                     
min         Find the minimum value of a column.                     
no-intro    Don't print introductory text.                          
output      Output the present table.                               
preview     Preview the present table                               
quit        Quit (synonymous with 'exit').                          
rename      Rename a column.                                        
run         Run a file containing a list of commands.               
select      Select columns for a new table.                         
select-rows Select rows for a new table.                            
set         Set the value of a parameter.                           
set-data    Set the entries of a column.                            
sort        Sort the entire table by a column.                      
version     Print version                                           
warranty    Show warranty information.                              

Notes:

1. Help for individual commands may be obtained with 'help command'.
   Required arguments are surrounded by <>'s and optional arguments are
   surrounded by []'s.

2. Options may also be specified in the environment variable ACOL_DEFAULTS.

3. Long options may be preceeded by two dashes.

4. In order to avoid argument confusion use "(-x*2)", not "-x*2"

Known operators:
() - ^ * / % + - = < > & |

Known functions:
abs(x) acos(x) acosh(x) asin(x) asinh(x) atan(x) atan2(x,y)
atanh(x) ceil(x) cos(x) cosh(x) cot(x) csc(x) eval(...) exp(x)
floor(x) if(x,y,z) int(x) log(x) log10(x) max(x,y) min(x,y)
sec(x) sin(x) sinh(x) sqrt(x) tan(x) tanh(x)

Compiled at 16:30:21 on May 15 2008 for o2scl_ext, version 0.102.

# ------------------------------------------------------------
# You can also get help on the commands individually, e.g.
# ------------------------------------------------------------
Running command: help create
Usage: create <name> <low> <hi> <step>

Create a table from uniform grid.

Create a new table with one column whose entries are an evenly-spaced grid.
This takes four arguments, the name of the column, the first value, the
increment between successive values and the maximum value. Note that finite
precision arithmetic may cause small deviations from the expected
result. 
# ------------------------------------------------------------
# The full command list is given with 'commands'
# ------------------------------------------------------------
Running command: commands
Command list:

alias       delete-rows generic     insert-full min         set-data    
assign      deriv       get         integ       output      sort        
binary      deriv2      get-row     internal    preview     version     
calc        file        help        interp      rename      warranty    
commands    find-row    html        license     select      
create      fit         index       list        select-rows 
delete-col  formula     insert      max         set         

# ------------------------------------------------------------
# Use 'create' to create a table with one column
# ------------------------------------------------------------
Running command: create x 0 1 0.1
# ------------------------------------------------------------
# Use 'formula' to apply a formula to create a new column
# ------------------------------------------------------------
Running command: formula sin(x) s
Running command: formula sqrt(1-s*s) c
# ------------------------------------------------------------
# The 'deriv' command computes derivatives
# ------------------------------------------------------------
Running command: deriv x s c2
# ------------------------------------------------------------
# Use 'output' to see the results
# ------------------------------------------------------------
Running command: output
 x             s             c             c2           
 0.000000e+00  0.000000e+00  1.000000e+00  9.999995e-01 
 1.000000e-01  9.983342e-02  9.950042e-01  9.950034e-01 
 2.000000e-01  1.986693e-01  9.800666e-01  9.800667e-01 
 3.000000e-01  2.955202e-01  9.553365e-01  9.553335e-01 
 4.000000e-01  3.894183e-01  9.210610e-01  9.210695e-01 
 5.000000e-01  4.794255e-01  8.775826e-01  8.775485e-01 
 6.000000e-01  5.646425e-01  8.253356e-01  8.254605e-01 
 7.000000e-01  6.442177e-01  7.648422e-01  7.643741e-01 
 8.000000e-01  7.173561e-01  6.967067e-01  6.984518e-01 
 9.000000e-01  7.833269e-01  6.216100e-01  6.150954e-01 
 1.000000e+00  8.414710e-01  5.403023e-01  5.646134e-01 
# ------------------------------------------------------------
# Or give 'output' command an argument to output to a file
# ------------------------------------------------------------
Running command: output test.txt
# ------------------------------------------------------------
# Shell commands are proceeded by an '!'
# ------------------------------------------------------------
acol: Executing system command: cat test.txt
 x             s             c             c2           
 0.000000e+00  0.000000e+00  1.000000e+00  9.999995e-01 
 1.000000e-01  9.983342e-02  9.950042e-01  9.950034e-01 
 2.000000e-01  1.986693e-01  9.800666e-01  9.800667e-01 
 3.000000e-01  2.955202e-01  9.553365e-01  9.553335e-01 
 4.000000e-01  3.894183e-01  9.210610e-01  9.210695e-01 
 5.000000e-01  4.794255e-01  8.775826e-01  8.775485e-01 
 6.000000e-01  5.646425e-01  8.253356e-01  8.254605e-01 
 7.000000e-01  6.442177e-01  7.648422e-01  7.643741e-01 
 8.000000e-01  7.173561e-01  6.967067e-01  6.984518e-01 
 9.000000e-01  7.833269e-01  6.216100e-01  6.150954e-01 
 1.000000e+00  8.414710e-01  5.403023e-01  5.646134e-01 
acol: Done with system command.
# ------------------------------------------------------------
# Or store the results in the internal format 
# ------------------------------------------------------------
Running command: internal test.o2
# ------------------------------------------------------------
# Generic test files can be read using the 'generic' command
# ------------------------------------------------------------
Running command: generic test.txt
Running command: output
 x             s             c             c2           
 0.000000e+00  0.000000e+00  1.000000e+00  9.999995e-01 
 1.000000e-01  9.983342e-02  9.950042e-01  9.950034e-01 
 2.000000e-01  1.986693e-01  9.800666e-01  9.800667e-01 
 3.000000e-01  2.955202e-01  9.553365e-01  9.553335e-01 
 4.000000e-01  3.894183e-01  9.210610e-01  9.210695e-01 
 5.000000e-01  4.794255e-01  8.775826e-01  8.775485e-01 
 6.000000e-01  5.646425e-01  8.253356e-01  8.254605e-01 
 7.000000e-01  6.442177e-01  7.648422e-01  7.643741e-01 
 8.000000e-01  7.173561e-01  6.967067e-01  6.984518e-01 
 9.000000e-01  7.833269e-01  6.216100e-01  6.150954e-01 
 1.000000e+00  8.414710e-01  5.403023e-01  5.646134e-01 
# ------------------------------------------------------------
# Files in the internal format can be read with 'file'
# ------------------------------------------------------------
Running command: file test.o2
Running command: output
 x             s             c             c2           
 0.000000e+00  0.000000e+00  1.000000e+00  9.999995e-01 
 1.000000e-01  9.983342e-02  9.950042e-01  9.950034e-01 
 2.000000e-01  1.986693e-01  9.800666e-01  9.800667e-01 
 3.000000e-01  2.955202e-01  9.553365e-01  9.553335e-01 
 4.000000e-01  3.894183e-01  9.210610e-01  9.210695e-01 
 5.000000e-01  4.794255e-01  8.775826e-01  8.775485e-01 
 6.000000e-01  5.646425e-01  8.253356e-01  8.254605e-01 
 7.000000e-01  6.442177e-01  7.648422e-01  7.643741e-01 
 8.000000e-01  7.173561e-01  6.967067e-01  6.984518e-01 
 9.000000e-01  7.833269e-01  6.216100e-01  6.150954e-01 
 1.000000e+00  8.414710e-01  5.403023e-01  5.646134e-01 
# ------------------------------------------------------------
# Tables also contain constant values in addition to data
# ------------------------------------------------------------
Running command: assign pi acos(-1.0)
# ------------------------------------------------------------
# The 'list' command lists the column and constant names
# ------------------------------------------------------------
Running command: list
Table name: acol
1 constant:
pi 3.141593e+00
4 columns: 
0. x  1. s  2. c  3. c2 
11 lines of data.
# ------------------------------------------------------------
# Constants can be used in expressions
# ------------------------------------------------------------
Running command: formula x*pi/2 x2
# ------------------------------------------------------------
# Columns can be renamed. Legal column names contain letters
# numbers and underscores, and begin with a letter.
# ------------------------------------------------------------
Running command: rename x2 x_2
Running command: output
 x             s             c             c2            x_2          
 0.000000e+00  0.000000e+00  1.000000e+00  9.999995e-01  0.000000e+00 
 1.000000e-01  9.983342e-02  9.950042e-01  9.950034e-01  1.570796e-01 
 2.000000e-01  1.986693e-01  9.800666e-01  9.800667e-01  3.141593e-01 
 3.000000e-01  2.955202e-01  9.553365e-01  9.553335e-01  4.712389e-01 
 4.000000e-01  3.894183e-01  9.210610e-01  9.210695e-01  6.283185e-01 
 5.000000e-01  4.794255e-01  8.775826e-01  8.775485e-01  7.853982e-01 
 6.000000e-01  5.646425e-01  8.253356e-01  8.254605e-01  9.424778e-01 
 7.000000e-01  6.442177e-01  7.648422e-01  7.643741e-01  1.099557e+00 
 8.000000e-01  7.173561e-01  6.967067e-01  6.984518e-01  1.256637e+00 
 9.000000e-01  7.833269e-01  6.216100e-01  6.150954e-01  1.413717e+00 
 1.000000e+00  8.414710e-01  5.403023e-01  5.646134e-01  1.570796e+00 
# ------------------------------------------------------------
# (Remove test files created earlier.)
# ------------------------------------------------------------
acol: Executing system command: rm test.txt
acol: Done with system command.
acol: Executing system command: rm test.o2
acol: Done with system command.

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).
Hosted at Get Object-oriented Scientific Computing
Lib at SourceForge.net. Fast, secure and Free Open Source software
downloads..