Is there a way to read just the first line of a text file? I've developed a system that reads delimited columns from a .CSV file. Now the users want new fields added to the input files, and some fields are renamed. The system has to be able to handle files in the new format as well as the old one, and do it transparently. If I could read the first line that would be great, as that line contains the field names.
Example follows. In the case of CSV data replace the End of Field Tab with Comma. I got this by using the interactive text import preview on the specified file and copied the Source script embedded in the resulting JMP file. I removed the specific reference to the number of columns to allow the script to work with any number of columns.
Open( "C:\Program Files (x86)\SAS\JMP\9\Support Files English\Sample Import Data\Animals_L.txt", Import Settings( End Of Line( CRLF, CR, LF ), End Of Field( Tab ), Strip Quotes( 1 ), Use Apostrophe as Quotation Mark( 0 ), Scan Whole File( 1 ), Treat empty columns as numeric( 0 ), Labels( 0 ), Column Names Start( 1 ), Data Starts( 1 ), Lines To Read( 1 ), Year Rule( "10-90" ) ) )