Subj : Re: Strip characters and lines from a text file To : All From : Jonathan de Boyne Pollard Date : Tue Feb 05 2002 09:13 pm From: Jonathan.de.Boyne.Pollard@f3.n342.z1.cereal.mv.com (Jonathan de Boyne Pollard) Subject: Re: Strip characters and lines from a text file From: Jonathan de Boyne Pollard MN> Is it possible to strip the first few characters from a MN> line in a text file. Yes. It is impossible to do robustly in the COMMAND and CMD scripting languages, because one cannot guard against text files that contain the '<', '>', '|', and '&' metacharacters. One can be more robust in the 4OS2/TCOS2/4NT/TCWIN32/4DOS scripting languages, as one can use the built in SETDOS command to turn off metacharacter recognition. However, this still makes for largely illegible scripts. On the other hand it is trivially easy to do robustly in REXX, which is an excellent scripting language for text and string processing tasks of this kind. Here is a robust REXX script that can be used as a filter. Supply the text file to be stripped as standard input, and the number of initial lines to skip and the number of characters to strip as arguments. Direct standard output (and add /? message and argument validation) according to taste. /*REXX*/ parse arg LinesToSkip CharactersToStrip . CurrentLine = 0 do while lines() > 0 line = linein() CurrentLine = CurrentLine + 1 if CurrentLine > LinesToSkip then call lineout, substr(line, CharactersToStrip + 1) end -- |Fidonet: Jonathan de Boyne Pollard 1:342/3 | | Origin: The Cereal Port BBS (603)899-3335 199.125.78.133 (1:132/152) --- # Origin: (1:132/152.4) * Origin: Baddog BBS (1:218/903) .