10.3.34 searchCsvColumn (gets a record with the search for specific column of CSV data)
Syntax
searchCsvColumn column character-string [file-path-name]
Description
This command searches for the value of field from the CSV file specified for argument and outputs all record containing the matched field.
Arguments
- column
-
This command searches for data for the specified column. If the matched field exists, the command outputs the record containing the filed. Specify a value not less than 1 for the column.
- character-string
-
This command specifies the field value to be searched. The extended regular expression can be used. To search for data enclosed with double quotation marks, you need to specify the double quotation mark by escaping \.
- file-path-name
-
This command specifies the path of the CSV file. If you do not specify the file path name, input from the standard input.
The size of CSV data that can be input is 100KB or less. If you input data larger than 100KB, the execution time of the job may become longer.
Output to the standard output
CSV data record.
Return codes
Return code |
Meaning |
---|---|
0 |
Normal termination |
Not less than 1 |
Termination with an error |
Notes
-
If matching field is not found, the command terminates with an error.
-
A value of more than 1 can be specified for column of argument, but whether the character string can be specified is not verified.
Examples
CSV data(data.csv) name,value,id "Yokohama",200,100 "Kawasaki",100,200 "Tokyo",200,300 searchCsvColumn 2 200 data.csv # The following contents are output: "Yokohama",200,100 "Tokyo",200,300 searchCsvColumn 1 \"Kawasaki\" data.csv # The following contents are output: "Kawasaki",100,200 searchCsvColumn 3 1.* data.csv # The following contents are output: "Yokohama",200,100