LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I delete text in a text file?

I'm editing a text file using "File I/O" functions and I'm trying to delete a complete row in the file. I tried to write backspaces (\b) over each character in the row but instead to delete them it appears squares. Does somebody know a better approach to delete text in a text file?

 

I'm using LV8.6.

 

I appreciate your help.

 

Hecuba.

Mfg. Test Engineer
Certified LabVIEW Associate Developer
0 Kudos
Message 1 of 3
(5,541 Views)
Read it in, delete the row within labview, and write it back.
--
Tim Elsey
Certified LabVIEW Architect
0 Kudos
Message 2 of 3
(5,528 Views)

A slight variant to elset's approach:

 

Use Read from Spreasheet file and place it into a 1D string array.  Use the \r ( carriage return) or \n (new line) delimiter which will place each line into array elements.

 

If you know the line number, you can delete the matching array element (first line being zero 0).

 

If you do not know the line number you can use the search array function which will return the element index that you can use to delete the element. 

 

Then use the Write to Spreadsheet file to restore the file, minus the line you wanted to remove.

0 Kudos
Message 3 of 3
(5,524 Views)