The trim command removes leading and/or trailing white space (spaces and tabs) from input fields, or truncates fields to a specific width. By default, both leading and trailing spaces are trimmed, but you can change this with the -l and -t flags described below.
See also: edit
Flag |
Req'd? |
Description |
-f fields |
No |
Species list of fields to trim. If no fields are specified, all fields are trimmed. |
-l |
No |
Trims leading white space. |
-t |
No |
Trims trailing white space. |
-w widths |
No |
Trims fields to widths by removing rightmost characters. |
The following example trims both leading and trailing whitespace from the spaces.csv file:
csvfix trim data/spaces.csv
which produces:
"1","leading"
"2","trailing"
"3","both"
This example truncates all fields in names.csv to a single character:
csvfix trim -w 1,1,1 data/names.csv
producing:
"C","D","M"
"J","A","F"
"H","M","M"
"F","O","M"
"G","E","F"
"V","W","F"
"O","W","M"
Created with the Personal Edition of HelpNDoc: iPhone web sites made easy