Expanding the benefits of the Unix "cut" utility

     The Unix cut utility is quite useful. The user can specify the delimiter. The delimiter is often a space, 0x20h. Columns are frequently spaced with consecutive spaces. Program 1sp.c converts strings of spaces to one space.
     The program is file oriented and won't run in a stdin-stdout environment. Thus, the input source must first be redirected into a file. "last" and "ls -l" are examples of input sources.
     Unix s/w here is Sun Sparc source code. This program uses calling module gcore.c and application module 1sp.c. gcore.c handles file management. 1sp.c looks for any occurrence of space[s] to convert to one space. Creating an executable file means compiling gcore.c, 1sp.c, and then linking them.
     Program usage is easy.The command line entry is:
program_name  [path]input_file  [path]output_file
File name checks are performed. The entered input filespec is checked to see if it exists, and the output filespec is checked to ensure it does NOT exist.
     Downloading info:
gcore.c is the calling module.
1sp.c is the application module.
1sp.zip is a zip file containing the 2 files above. Unix zip files are compatible with both PKZIP and WinZip.

Go to Home Page
Return to previously viewed page
Send <Neal> comments