There are probably many ways this can be scripted. Here is one example using the different import text options. A tab delimited file is assumed here.
There are probably many ways this can be scripted. Here is one example using the different import text options. A tab delimited file is assumed here.
[PRE]
//Open only first two rows
dt = Open(
"path/file.txt",
Import Settings(
End Of Field( Tab ),
Labels( 1 ),
Column Names Start( 1 ),
Data Starts( 2 ),
Lines To Read( 1 ),
)
);
// Create a list of new column names
names = {};
For( j = 1, j <= N Col( dt ), j++,
Insert Into( names, Column( j ) << get name() || " " || Char(Column( j )[1]))
);
Close( dt, nosave );
//Open again, include all data from row 3
dt = Open(
"path/file.txt",
Import Settings(
End Of Line( CRLF, CR, LF ),
End Of Field( Tab ),
Column Names Start( 1 ),
Data Starts( 3 ),
)
);
//Set column names
For( j = 1, j <= N Col( dt ), j++,
Column( j ) << set name( names[j]))
[/PRE]