Write specific lines from one file to anotherI have a large txt file. I want to find the lines starting with a specific string (e.g. "student name=") and copy the entire of such lines into another file.
How can I do it with JMP scripting?
If it is not straightforward with JMP, is there a simple method by excel or other tools?
Re: Write specific lines from one file to another@Mark_Bailey responded with a scripting solution. I am thinking that what you are really trying to do, may be to create a new JMP data table from an existing data table, based upon finding all rows in the data table that contain the string "student name=".
This can be done very easily using the interactive tools within JMP.
1. Open the data table you are interested in
2. Right click on the column header over the rowstate column(row number column) and select
Row Selection==>Select Where

3. Select the column you want to query against, and then choose "Contains" and then type in the value, "student name="

4. The result of this operation, will select all rows that has the phrase "student name=".

5. You can then go to
Tables==>Subset
and subset all rows that have been selected

Re: Write specific lines from one file to anotherSee if you can adapt this illustrative script to suit your situation:
Names Default to Here( 1 );
text = Load Text File( "YourText1.txt" );
line = Words( text, "\!n" );
text = "";
For( i = 1, i <= N Items( line ), i++,
If( Contains( line[i], "student name =" ),
text ||= line[i] || "\!n";
);
);
Save Text File( "YourText2.txt", text );