Cut utility example

If you are on a UNIX machine, you can put subsets of the fields from data files into separate Adaptive Server tables if you first invoke the cut utility to strip and save the desired columns from the file. Use the following command:

cut -f list -d , view_data_file > output_file_name

where:

After using cut, you can use the bcp utility to import the data in the output_file_name into an Adaptive Server table. Historical Server might return lines to the view_data_file that are similar to:

1995/3/25 10:32:39,master,0,0,0
1995/3/25 10:32:39,sysprocsdev,0,0,0
1995/3/25 10:32:39,ANewDBDevice,0,0,0
1995/3/25 10:32:39,ATestDevice,0,0,0
1995/3/25 10:32:40,master,0,0,0
1995/3/25 10:32:40,sysprocsdev,0,0,0
1995/3/25 10:32:40,ANewDBDevic,0,0,0
1995/3/25 10:32:40,ATestDevice,0,0,0

Suppose that you are interested in just the total I/O for each device during the sample. You could execute the following command to cut out the data you want by executing the following command:

cut -f1,2,5 -d, d1_1_device_io > d1_1_device.io.new

where field 1 is the date and time of the sample, 2 is the second field, which is the device name, and 5 is the fifth field, which is the device I/O value.

Now you can import the d1_1_device.new file into an Adaptive Server table as described in the previous section, “Bulk copy example”.

For more information about the cut utility, refer to the UNIX man pages on your system.