file_info

Commands ››
Parent Previous Next

The file_info command prepends the filename and line number for the CSV input file in the output stream. It is useful for identifying where particular data came from when you are processing large numbers of files. If the input is actually from standard input, the special token <stdin> is used as the file name.

See also: sequence, put

Flag

Req'd?

Description

-b

No

Strips any path information from the file name.

-tc

No

Specifies that filename and line number should appear in two separate CSV fields.



The following example lists all rows from the cities.csv and names.csv data files. It prepends the base file name (no path information) and line number:

csvfix file_info -b data/cities.csv  data/names.csv

which produces:

"cities.csv (1)","London","GB"
"cities.csv (2)","Paris","FR"
"cities.csv (3)","Edinburgh","GB"
"cities.csv (4)","Amsterdam","NL"
"cities.csv (5)","Rome","IT"
"cities.csv (6)","Athens","GR"
"cities.csv (7)","Berlin","DE"
"names.csv (1)","Charles","Dickens","M"
"names.csv (2)","Jane","Austen","F"
"names.csv (3)","Herman","Melville","M"
"names.csv (4)","Flann","O'Brien","M"
"names.csv (5)","George","Elliot","F"
"names.csv (6)","Virginia","Woolf","F"
"names.csv (7)","Oscar","Wilde","M"

Created with the Personal Edition of HelpNDoc: iPhone web sites made easy