$SEARCH$, $LEFT$, and $RIGHT$

$SEARCH$, $LEFT$, and $RIGHT$ are assigned values using the SEARCH function. The SEARCH function is used within an If statement to search the user's text file for a text string. If the text string is found, the variable $SEARCH$ is assigned the numeric value of the line number in which the string was first found in the user's text file. $LEFT$ is assigned the string value of whatever is on the line in the user's text file to the left of the searched for string. $RIGHT$ is assigned the string value of whatever is on the line in the user's text file to the right of the searched for string. For example, the tenth line in the user's text file is:

c:\dos\share /l:500

Search for share and the three variables are defined as follows:

$SEARCH$ = 10

$LEFT$ = c:\dos\

$RIGHT$ = /l:500

These variables (along with the IF function and ADDTEXT function) can be used to edit specific lines in text files. Common uses of these variables are:

  • Adding parameters to commands currently in Autoexec.bat or Config.sys files without removing existing parameters.
  • Editing a line in a database or network control text file.