Batch File to edit specific line of Text file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
werejago
Posts: 21
Joined: 01 Oct 2020 07:43

Re: Batch File to edit specific line of Text file

#16 Post by werejago » 09 Oct 2020 06:26

For example could you break down the script?

Call :GetIn Num
setlocal EnableDelayedExpansion
>"!file!.~tmp" echo(!line1!
>>"!file!.~tmp" echo(!num!
<"!file!" >>"!file!.~tmp" more +2

werejago
Posts: 21
Joined: 01 Oct 2020 07:43

Re: Batch File to edit specific line of Text file

#17 Post by werejago » 09 Oct 2020 07:45

Okay I came up with another mission with my Serialization text file script.

I want to verify the lines of the copied text file has "3331" text lines to verify the file hasn't been modified.

I'm trying to have a verification process that the Serialization file.txt (copied from master folder) has the correct amount of text lines, "3331".

And if not alert the user that their isn't a match and to confirm if they wish to continue.

This is the current batch code I'm using for this project below.


Code: Select all

@echo off
rem /*_________________________________________Deletes all Files in folder besides itself or other folders */ 
9>>"%~f0" (>nul 2>&1 del /f /q *.*)

rem /*_________________________________________Copies files from Master Files folder and renames designated files */ 
xcopy "Z:\Production\Cell 3 and 4\Laser Engraver Master Files" "Z:\Users\Wesley Kirk\Wes2\Barcode Serialization Files" 
rename "Sensor Engraving Master File.EZD" "Sensor Engraving.EZD"
rename "Sensor Serialization Master File.txt" "Sensor Serialization.txt"


@echo off & Goto :Main
rem /*_________________________________________Functions; sets parameters, sets input, verfies input to parameters */
:GetIN
 Setlocal EnableDelayedExpansion
 Set "Input=(Set "nVar="&Echo/Enter # Digit Work Order:&(For /L %%. in (1 1 #)Do For /F "Delims=" %%G in ('Choice /N /C 0123456789')Do (<Nul Set /P"=%

%G"&Set "nvar=^^!nVar^^!%%G"))&Echo/&Echo/Confirm: ^^!nVar^^! Y/N & For /F "Delims=" %%v in ('Choice /N')Do (If /I "%%~v"=="n" (Goto :retry)))"
:retry
 %Input:#=8% & Echo/Var [!nVar!] Confirmed
 Endlocal & Set "%1=%nVar%" 2> Nul
Exit /B 0

rem /*_________________________________________Script Body; reads/writes to Serialization.txt line 2 */ 
:Main
set "file=Sensor Serialization.txt"
<"%file%" set /p "line1="
Call :GetIn Num
setlocal EnableDelayedExpansion
>"!file!.~tmp" echo(!line1!
>>"!file!.~tmp" echo(!num!
<"!file!" >>"!file!.~tmp" more +2
move /y "!file!.~tmp" "!file!"
Endlocal

rem /*_________________________________________Starts notepad/ezcad2, opens Serialization.txt/sensor engraving.ezd to verify workorder number  */ 
start notepad "Sensor Serialization.txt"
Last edited by aGerman on 09 Oct 2020 10:33, edited 2 times in total.
Reason: please use code formatting

T3RRY
Posts: 83
Joined: 06 May 2020 10:14

Re: Batch File to edit specific line of Text file

#18 Post by T3RRY » 10 Oct 2020 09:12

why not a simple line counter with something like this:

Code: Select all

Set "lines="&For /F "Delims=" %%F in (%~1)Do Set /A lines+=1
with %~1 being a stand in for the file you want to get the line count for.

Of course, the line count being the same doesn't actually mean the file hasn't been modified. File attributes such as last written date and byte count are additional data points you can use to verify the file has not been modified if it's critical to your scripts execution.

Code: Select all

For /F "Delims=" %%G in ('dir /B "%~1" /A:-D /O:D /T:W')Do (set "WriteD=%%~tG" & Set "Fsize=%%~zG")
again, with %~1 being a stand in for the file you want to get the attributes for.

T3RRY
Posts: 83
Joined: 06 May 2020 10:14

Re: Batch File to edit specific line of Text file

#19 Post by T3RRY » 10 Oct 2020 10:12

werejago wrote:
09 Oct 2020 06:26
For example could you break down the script?

Code: Select all

@echo off & Goto :Main
rem /*_________________________________________Functions */
:GetIN
 Setlocal EnableDelayedExpansion
 Set "Input=(Set "nVar="&Echo/Enter # Digit Integer:&(For /L %%. in (1 1 #)Do For /F "Delims=" %%G in ('Choice /N /C 0123456789')Do (<Nul Set /P"=%%G"&Set "nvar=^^!nVar^^!%%G"))&Echo/&Echo/Confirm: ^^!nVar^^! Y/N & For /F "Delims=" %%v in ('Choice /N')Do (If /I "%%~v"=="n" (Goto :retry)))"
:retry
 %Input:#=8% & Echo/Var [!nVar!] Confirmed
 Endlocal & Set "%1=%nVar%" 2> Nul
Exit /B 0
rem /*_________________________________________Script Body */ 
:Main
set "file=Sensor Serialization.txt"
<"%file%" set /p "line1="
Call :GetIn Num
setlocal EnableDelayedExpansion
>"!file!.~tmp" echo(!line1!
>>"!file!.~tmp" echo(!num!
<"!file!" >>"!file!.~tmp" more +2
move /y "!file!.~tmp" "!file!"
Endlocal
First up:

Code: Select all

@echo off & Goto :Main
- Control script flow - prevent unwanted execution of function labels by using Goto :main label

Code: Select all

:GetIN
 Setlocal EnableDelayedExpansion
  Set "Input=(Set "nVar="&Echo/Enter # Digit Integer:&(For /L %%. in (1 1 #)Do For /F "Delims=" %%G in ('Choice /N /C 0123456789')Do (<Nul Set /P"=%%G"&Set "nvar=^^!nVar^^!%%G"))&Echo/&Echo/Confirm: ^^!nVar^^! Y/N & For /F "Delims=" %%v in ('Choice /N')Do (If /I "%%~v"=="n" (Goto :retry)))"
- Called label :GetIn uses %1 as a return var to return the accepted input value
- Input Macro: Uses For /F loops to iterate over the choice command a number of times equal to the value substituted for # when the macro is expanded. Parenthesis within the macro's definition is used to seperate the for loop that is used to select and concatenate input values from the For /F loop over choice that is used to accept or reject the value, with the script looping to the retry label if the concatenated value is rejected.
- because the macro is defined in a delayed expansion environment, escaping of the ! character with ^^ is required to prevent the parser expanding the string as a variable during the macro's definition. Once defined in this manner, a macro contains the literal value of "!string!" as opposed to "variables value".

Code: Select all

:retry
 %Input:#=8% & Echo/Var [!nVar!] Confirmed
 
- "%Input:#=8%" is the expansion of the input macro, using substring modification syntax to supply the input length
- "& Echo/Var [!nVar!] Confirmed" executes after the input macro finishes executing, once a value has been accepted.

Code: Select all

 Endlocal & Set "%1=%nVar%" 2> Nul
Exit /B 0

- using concatenation of the Endlocal & Set command on the same line (or within code block) allows a variable value to be returned across the endlocal barrier.
- "2> Nul" redirects a syntax error for some reason the function is called without a parameter for a return var
- "Exit /B 0" ends the command process created with the Call command and returns to the parent script from the point immediately after the call

A clearer, remarked expression of the above input macro used in the :GetIn function,as it would be scripted if it was used whole as a function as opposed to a macro:

Code: Select all

:GetIN <ReturnVar> <Required String Length as Integer>
rem /* Ensure environment that allows for concatenation of variables with values with correct values during code blocks */
 Setlocal EnableDelayedExpansion
 rem /* ensure no conflict with any potential pre-existing nVar variable used to build input string */
 Set "nVar="
 Echo/Enter a %2 Digit Integer [0-9]:
 rem /* use a For /L loop n times to enact a for /F loop on the Choice command, with n being the value passed as Arg 2. [Substring modification replacing # in macro]  */
  rem /* the for /F loop catches the literal character entered as the choice instead of the errorlevel, each input is displayed on same line using Set /P */
  rem /* Note: /N switch MUST be used and /M switch CANNOT be used to correctly catch input from choice using the For /F loop */
 For /L %%. in (1 1 %2)Do For /F "Delims=" %%G in ('Choice /N /C 0123456789')Do (
  <Nul Set /P"=%%G"
  rem /* Build the string using delayed expansion to update it with each new input */
  Set "nvar=!nVar!%%G"
 )
 Echo/
 Echo/Confirm: !nVar! Y/N
  rem /* Use default choice to confirm entered string is acceptable, send to retry label if rejected */
 For /F "Delims=" %%v in ('Choice /N')Do  If /I "%%~v"=="n" (Goto :retry)
 Echo/%1 [!nVar!] Confirmed
  rem /* end the Setlocal used in the function and tunnel the return value to Arg 1 return variable by concatenating the commands on the same line */
 Endlocal & Set "%1=%nVar%" 2> Nul
  rem /* Exit the command process initiated by Call :GetIn and return to the script immedatialy after the point the call was initiated */
 Exit /B 0
"<" , ">" and ">>" are redirection operators that instruct cmd.exe what source to read or write input from, with:
- "<" being read
- ">" being overwrite
- ">>" being Append

- "Set /P" can only ever read the first line of input from a file as a single command.

Not used in this script, however: A code block can be used to read multiple lines from a file with multiple Set /P commands Eg:

Code: Select all

 <"file.ext" (
 Set /P "line1="
 Set /P "line2="
)

Code: Select all

 >"!file!.~tmp" echo(!line1!
- Overwite / Write new "!file!.~tmp" with output line value of !line1!

Code: Select all

 >>"!file!.~tmp" echo(!num!
- Append value entered for num via :GetIn function and input macro to "!file!.~tmp"

Code: Select all

 <"!file!" >>"!file!.~tmp" more +2
- read file "!file!" and append lines 3 and onwards to "!file!.~tmp", using the +n syntax of the more command to 'skip' the first two lines.

Code: Select all

setlocal EnableDelayedExpansion
- in the context of macro definition and expansions, allows control of how strings are parsed at the time of expansion by inhibiting the expansion of yet to be defined variables during the macro's definiton.

- In the context of expanding file names from variables or contents of lines from files that have been assigned to variables, allows parsing of content containing poison characters that would otherwise cause the command interpreter to fail. Can present a problem if filenames or contents contain ! characters, as they will attempt to expand during parsing when they are defined. If this is likely to present a problem, This can be avoided by defining such variables in an Environment where delayed expansion is disabled, and enabling delayed expansion only when the values of such variables need to be assessed or output.

Apologies if I've broken it down too far, I've made no assumptions regarding your current knowledge base.

werejago
Posts: 21
Joined: 01 Oct 2020 07:43

Re: Batch File to edit specific line of Text file

#20 Post by werejago » 13 Oct 2020 08:41

Thank you T3rry that's exactly what I was looking for - a detailed explanation.

Does anyone know of an easy way to add a "verify if a text file is read only or not" and if it is to continue the script and if not to ask if you want to continue with the script or not?



I'm trying to verify the "Sensor Serialization Master File.txt" is read only before it copies/paste/renames the file into a new folder.

This is the entirely of my script below...



@echo off
rem /*_________________________________________Deletes all Files in folder besides itself or other folders */
9>>"%~f0" (>nul 2>&1 del /f /q *.*)

rem /*_________________________________________Copies and rename designated files */
xcopy "Z:\Users\Wesley Kirk\Wes\Laser Engraver Master Files" "Z:\Users\Wesley Kirk\Wes\Barcode Serialization Files"
rename "Sensor Engraving Master File.EZD" "Sensor Engraving.EZD"
rename "Sensor Serialization Master File.txt" "Sensor Serialization.txt"


@echo off & Goto :Main
rem /*_________________________________________Functions; sets permeteres, sets input */
:GetIN
Setlocal EnableDelayedExpansion
Set "Input=(Set "nVar="&Echo/Enter # Digit Integer:&(For /L %%. in (1 1 #)Do For /F "Delims=" %%G in ('Choice /N /C 0123456789')Do (<Nul Set /P"=%%G"&Set

"nvar=^^!nVar^^!%%G"))&Echo/&Echo/Confirm: ^^!nVar^^! Y/N & For /F "Delims=" %%v in ('Choice /N')Do (If /I "%%~v"=="n" (Goto :retry)))"
:retry
%Input:#=8% & Echo/Var [!nVar!] Confirmed
Endlocal & Set "%1=%nVar%" 2> Nul
Exit /B 0
rem /*_________________________________________Script Body */
:Main
set "file=Sensor Serialization.txt"
<"%file%" set /p "line1="
Call :GetIn Num
setlocal EnableDelayedExpansion
>"!file!.~tmp" echo(!line1!
>>"!file!.~tmp" echo(!num!
<"!file!" >>"!file!.~tmp" more +2
move /y "!file!.~tmp" "!file!"
Endlocal



start notepad "Sensor Serialization.txt"

T3RRY
Posts: 83
Joined: 06 May 2020 10:14

Re: Batch File to edit specific line of Text file

#21 Post by T3RRY » 13 Oct 2020 11:17

within a for loop, the for metavriable can be expanded with the modifier ~a to output the files attributes. Output is a list of letters indicating attributes in format:

Code: Select all

--a--------

  R   Read-only file attribute.
  A   Archive file attribute.
  S   System file attribute.
  H   Hidden file attribute.
  O   Offline attribute.
  I   Not content indexed file attribute.
  X   No scrub file attribute.
  V   Integrity attribute.
  P   Pinned attribute.
  U   Unpinned attribute.
  B   SMR Blob attribute.
this can be used to test for a specific attribute by outputing the variable containing the attrib modifier to findstr and testing for the relevent letter.
conditional operators && and || can be used to enact commands depending on whether the attribute is present or not.

Code: Select all

For /F "delims=" %%G in ('dir /b "Sensor Serialization Master File.txt"')Do (Echo/%%~aG | findstr /lic:r > nul 2> nul && Echo read only || echo not read only)
As for the easy menu aspect of your question, feel free to check out my menu macro's in the 2nd script in my answer here: https://stackoverflow.com/a/61823099/12343998

Alternately:

Code: Select all

(dir /b "Sensor Serialization Master File.txt" /A:r > nul 2> nul && Echo/true) || Echo/false

werejago
Posts: 21
Joined: 01 Oct 2020 07:43

Re: Batch File to edit specific line of Text file

#22 Post by werejago » 14 Oct 2020 06:46

I couldn't get a test sample running on the command (dir /b "Sensor Serialization Master File.txt" /A:r > nul 2> nul && Echo/true) || Echo/false
is there anything I'm missing ? I tried Pause or Echo on/off to no success.

Thank you

werejago
Posts: 21
Joined: 01 Oct 2020 07:43

Re: Batch File to edit specific line of Text file

#23 Post by werejago » 14 Oct 2020 07:11

Also I tried implementing:

For /F "delims=" %%G in ('dir /b "Z:\Users\Wesley Kirk\Wes\Laser Engraver Master Files\Sensor Serialization Master File.txt"')Do (Echo/%%~aG | findstr /lic:r > nul 2> nul && Echo read only || echo not read only)


It says file is not read only-when it is read only.

Also I'm trying to have the user acknowledge the file is read only by confirming along with confirming the 8 digit work order number.

T3RRY
Posts: 83
Joined: 06 May 2020 10:14

Re: Batch File to edit specific line of Text file

#24 Post by T3RRY » 14 Oct 2020 08:10

werejago wrote:
14 Oct 2020 06:46
I couldn't get a test sample running on the command (dir /b "Sensor Serialization Master File.txt" /A:r > nul 2> nul && Echo/true) || Echo/false
is there anything I'm missing ? I tried Pause or Echo on/off to no success.

Thank you
that will occur if the file is in a directory other than the working directory the batch is running from. use the full path, or navigate to that directory using pushd

Image

werejago
Posts: 21
Joined: 01 Oct 2020 07:43

Re: Batch File to edit specific line of Text file

#25 Post by werejago » 16 Oct 2020 11:38

I have a dyer request. I'm having trouble modifying the code below and I'm trying to add a modification.


The first Completed objective is to have a user input an "8 digit work order number" into a command prompt to edit line 2 in "Serilization file.txt".

Now...the next objective is to slightly modify how the user is prompt; to be able to start in any position on text line 4 (ex. position: 01A01 through 26H16) in the "Serilization file.txt" (another program uses Serilization file.txt as a reference point on which position it's on).

Ex. I already have this:
User clicks .bat file to automate a cmd prompt window to ask user for, "8 digit work order number" and to enter "Y/N" to confirm.
The current code that successfully modifies the "8 digit work order number" (text line 2) in the "Serialization file.txt" is below.

Code: Select all

@echo off & Goto :Main
rem /*_________________________________________Functions; sets parameters, sets input, verfies input to parameters */
:GetIN
 Setlocal EnableDelayedExpansion
 Set "Input=(Set "nVar="&Echo/Enter # Digit Work Order:&(For /L %%. in (1 1 #)Do For /F "Delims=" %%G in ('Choice /N /C 0123456789')Do (<Nul Set /P"=%%G"&Set "nvar=^^!nVar^^!%%G"))&Echo/&Echo/Confirm: ^^!nVar^^! Y/N & For /F "Delims=" %%v in ('Choice /N')Do (If /I "%%~v"=="n" (Goto :retry)))"
:retry
 %Input:#=8% & Echo/Var [!nVar!] Confirmed
 Endlocal & Set "%1=%nVar%" 2> Nul
Exit /B 0

rem /*_________________________________________Script Body; reads/writes to Serialization.txt line 2 */ 
:Main
set "file=Sensor Serialization.txt"
<"%file%" set /p "line1="
Call :GetIn Num
setlocal EnableDelayedExpansion
>"!file!.~tmp" echo(!line1!
>>"!file!.~tmp" echo(!num!
<"!file!" >>"!file!.~tmp" more +2
move /y "!file!.~tmp" "!file!"
Endlocal
AFTER this instead of ending I want to ask the user, "Start from beginning? Y/N" if "Y" then it continues script as normal.

IF "N" then it prompts user to enter the starting point (ex. 01A01 through 26H16) in the "Serilization file.txt", while still modifying the previously entered "8 digit work order number" in "Serilization file.txt" as usual.

Ex. User inputs "N" for "Starting from the beginning?"
Prompt asks user to "enter starting position", user inputs starting position, "01G01", for example.
I want to delete all lines between position 01A01 through 01F16 (to insure we're at text line "01G01" in "Serilization file.txt" and save as usual.

Again the "Serilization file.txt" contents look like this:

Code: Select all

Enter the eight-digit sensor lot number (minus the WSV and the dashes) on Line 2:
03252001
Begin sensor serializaitons, DO NOT change information on Line 3 or beyond.
01A01
01A02
01A03
01A04
01A05
01A06
01A07
01A08
01A09
01A10
01A11
01A12
01A13
01A14
01A15
01A16
01B01
01B02
01B03
01B04
01B05
01B06
01B07
01B08
01B09
01B10
01B11
01B12
01B13
01B14
01B15
01B16
01C01
01C02
01C03
01C04
01C05
01C06
01C07
01C08
01C09
01C10
01C11
01C12
01C13
01C14
01C15
01C16
01D01
01D02
01D03
01D04
01D05
01D06
01D07
01D08
01D09
01D10
01D11
01D12
01D13
01D14
01D15
01D16
01E01
01E02
01E03
01E04
01E05
01E06
01E07
01E08
01E09
01E10
01E11
01E12
01E13
01E14
01E15
01E16
01F01
01F02
01F03
01F04
01F05
01F06
01F07
01F08
01F09
01F10
01F11
01F12
01F13
01F14
01F15
01F16
01G01
01G02
01G03
01G04
01G05
01G06
01G07
01G08
01G09
01G10
01G11
01G12
01G13
01G14
01G15
01G16
01H01
01H02
01H03
01H04
01H05
01H06
01H07
01H08
01H09
01H10
01H11
01H12
01H13
01H14
01H15
01H16
02A01
02A02
02A03
02A04
02A05
02A06
02A07
02A08
02A09
02A10
02A11
02A12
02A13
02A14
02A15
02A16
02B01
02B02
02B03
02B04
02B05
02B06
02B07
02B08
02B09
02B10
02B11
02B12
02B13
02B14
02B15
02B16
02C01
02C02
02C03
02C04
02C05
02C06
02C07
02C08
02C09
02C10
02C11
02C12
02C13
02C14
02C15
02C16
02D01
02D02
02D03
02D04
02D05
02D06
02D07
02D08
02D09
02D10
02D11
02D12
02D13
02D14
02D15
02D16
02E01
02E02
02E03
02E04
02E05
02E06
02E07
02E08
02E09
02E10
02E11
02E12
02E13
02E14
02E15
02E16
02F01
02F02
02F03
02F04
02F05
02F06
02F07
02F08
02F09
02F10
02F11
02F12
02F13
02F14
02F15
02F16
02G01
02G02
02G03
02G04
02G05
02G06
02G07
02G08
02G09
02G10
02G11
02G12
02G13
02G14
02G15
02G16
02H01
02H02
02H03
02H04
02H05
02H06
02H07
02H08
02H09
02H10
02H11
02H12
02H13
02H14
02H15
02H16
03A01
03A02
03A03
03A04
03A05
03A06
03A07
03A08
03A09
03A10
03A11
03A12
03A13
03A14
03A15
03A16
03B01
03B02
03B03
03B04
03B05
03B06
03B07
03B08
03B09
03B10
03B11
03B12
03B13
03B14
03B15
03B16
03C01
03C02
03C03
03C04
03C05
03C06
03C07
03C08
03C09
03C10
03C11
03C12
03C13
03C14
03C15
03C16
03D01
03D02
03D03
03D04
03D05
03D06
03D07
03D08
03D09
03D10
03D11
03D12
03D13
03D14
03D15
03D16
03E01
03E02
03E03
03E04
03E05
03E06
03E07
03E08
03E09
03E10
03E11
03E12
03E13
03E14
03E15
03E16
03F01
03F02
03F03
03F04
03F05
03F06
03F07
03F08
03F09
03F10
03F11
03F12
03F13
03F14
03F15
03F16
03G01
03G02
03G03
03G04
03G05
03G06
03G07
03G08
03G09
03G10
03G11
03G12
03G13
03G14
03G15
03G16
03H01
03H02
03H03
03H04
03H05
03H06
03H07
03H08
03H09
03H10
03H11
03H12
03H13
03H14
03H15
03H16
04A01
04A02
04A03
04A04
04A05
04A06
04A07
04A08
04A09
04A10
04A11
04A12
04A13
04A14
04A15
04A16
04B01
04B02
04B03
04B04
04B05
04B06
04B07
04B08
04B09
04B10
04B11
04B12
04B13
04B14
04B15
04B16
04C01
04C02
04C03
04C04
04C05
04C06
04C07
04C08
04C09
04C10
04C11
04C12
04C13
04C14
04C15
04C16
04D01
04D02
04D03
04D04
04D05
04D06
04D07
04D08
04D09
04D10
04D11
04D12
04D13
04D14
04D15
04D16
04E01
04E02
04E03
04E04
04E05
04E06
04E07
04E08
04E09
04E10
04E11
04E12
04E13
04E14
04E15
04E16
04F01
04F02
04F03
04F04
04F05
04F06
04F07
04F08
04F09
04F10
04F11
04F12
04F13
04F14
04F15
04F16
04G01
04G02
04G03
04G04
04G05
04G06
04G07
04G08
04G09
04G10
04G11
04G12
04G13
04G14
04G15
04G16
04H01
04H02
04H03
04H04
04H05
04H06
04H07
04H08
04H09
04H10
04H11
04H12
04H13
04H14
04H15
04H16
05A01
05A02
05A03
05A04
05A05
05A06
05A07
05A08
05A09
05A10
05A11
05A12
05A13
05A14
05A15
05A16
05B01
05B02
05B03
05B04
05B05
05B06
05B07
05B08
05B09
05B10
05B11
05B12
05B13
05B14
05B15
05B16
05C01
05C02
05C03
05C04
05C05
05C06
05C07
05C08
05C09
05C10
05C11
05C12
05C13
05C14
05C15
05C16
05D01
05D02
05D03
05D04
05D05
05D06
05D07
05D08
05D09
05D10
05D11
05D12
05D13
05D14
05D15
05D16
05E01
05E02
05E03
05E04
05E05
05E06
05E07
05E08
05E09
05E10
05E11
05E12
05E13
05E14
05E15
05E16
05F01
05F02
05F03
05F04
05F05
05F06
05F07
05F08
05F09
05F10
05F11
05F12
05F13
05F14
05F15
05F16
05G01
05G02
05G03
05G04
05G05
05G06
05G07
05G08
05G09
05G10
05G11
05G12
05G13
05G14
05G15
05G16
05H01
05H02
05H03
05H04
05H05
05H06
05H07
05H08
05H09
05H10
05H11
05H12
05H13
05H14
05H15
05H16
06A01
06A02
06A03
06A04
06A05
06A06
06A07
06A08
06A09
06A10
06A11
06A12
06A13
06A14
06A15
06A16
06B01
06B02
06B03
06B04
06B05
06B06
06B07
06B08
06B09
06B10
06B11
06B12
06B13
06B14
06B15
06B16
06C01
06C02
06C03
06C04
06C05
06C06
06C07
06C08
06C09
06C10
06C11
06C12
06C13
06C14
06C15
06C16
06D01
06D02
06D03
06D04
06D05
06D06
06D07
06D08
06D09
06D10
06D11
06D12
06D13
06D14
06D15
06D16
06E01
06E02
06E03
06E04
06E05
06E06
06E07
06E08
06E09
06E10
06E11
06E12
06E13
06E14
06E15
06E16
06F01
06F02
06F03
06F04
06F05
06F06
06F07
06F08
06F09
06F10
06F11
06F12
06F13
06F14
06F15
06F16
06G01
06G02
06G03
06G04
06G05
06G06
06G07
06G08
06G09
06G10
06G11
06G12
06G13
06G14
06G15
06G16
06H01
06H02
06H03
06H04
06H05
06H06
06H07
06H08
06H09
06H10
06H11
06H12
06H13
06H14
06H15
06H16
07A01
07A02
07A03
07A04
07A05
07A06
07A07
07A08
07A09
07A10
07A11
07A12
07A13
07A14
07A15
07A16
07B01
07B02
07B03
07B04
07B05
07B06
07B07
07B08
07B09
07B10
07B11
07B12
07B13
07B14
07B15
07B16
07C01
07C02
07C03
07C04
07C05
07C06
07C07
07C08
07C09
07C10
07C11
07C12
07C13
07C14
07C15
07C16
07D01
07D02
07D03
07D04
07D05
07D06
07D07
07D08
07D09
07D10
07D11
07D12
07D13
07D14
07D15
07D16
07E01
07E02
07E03
07E04
07E05
07E06
07E07
07E08
07E09
07E10
07E11
07E12
07E13
07E14
07E15
07E16
07F01
07F02
07F03
07F04
07F05
07F06
07F07
07F08
07F09
07F10
07F11
07F12
07F13
07F14
07F15
07F16
07G01
07G02
07G03
07G04
07G05
07G06
07G07
07G08
07G09
07G10
07G11
07G12
07G13
07G14
07G15
07G16
07H01
07H02
07H03
07H04
07H05
07H06
07H07
07H08
07H09
07H10
07H11
07H12
07H13
07H14
07H15
07H16
08A01
08A02
08A03
08A04
08A05
08A06
08A07
08A08
08A09
08A10
08A11
08A12
08A13
08A14
08A15
08A16
08B01
08B02
08B03
08B04
08B05
08B06
08B07
08B08
08B09
08B10
08B11
08B12
08B13
08B14
08B15
08B16
08C01
08C02
08C03
08C04
08C05
08C06
08C07
08C08
08C09
08C10
08C11
08C12
08C13
08C14
08C15
08C16
08D01
08D02
08D03
08D04
08D05
08D06
08D07
08D08
08D09
08D10
08D11
08D12
08D13
08D14
08D15
08D16
08E01
08E02
08E03
08E04
08E05
08E06
08E07
08E08
08E09
08E10
08E11
08E12
08E13
08E14
08E15
08E16
08F01
08F02
08F03
08F04
08F05
08F06
08F07
08F08
08F09
08F10
08F11
08F12
08F13
08F14
08F15
08F16
08G01
08G02
08G03
08G04
08G05
08G06
08G07
08G08
08G09
08G10
08G11
08G12
08G13
08G14
08G15
08G16
08H01
08H02
08H03
08H04
08H05
08H06
08H07
08H08
08H09
08H10
08H11
08H12
08H13
08H14
08H15
08H16
09A01
09A02
09A03
09A04
09A05
09A06
09A07
09A08
09A09
09A10
09A11
09A12
09A13
09A14
09A15
09A16
09B01
09B02
09B03
09B04
09B05
09B06
09B07
09B08
09B09
09B10
09B11
09B12
09B13
09B14
09B15
09B16
09C01
09C02
09C03
09C04
09C05
09C06
09C07
09C08
09C09
09C10
09C11
09C12
09C13
09C14
09C15
09C16
09D01
09D02
09D03
09D04
09D05
09D06
09D07
09D08
09D09
09D10
09D11
09D12
09D13
09D14
09D15
09D16
09E01
09E02
09E03
09E04
09E05
09E06
09E07
09E08
09E09
09E10
09E11
09E12
09E13
09E14
09E15
09E16
09F01
09F02
09F03
09F04
09F05
09F06
09F07
09F08
09F09
09F10
09F11
09F12
09F13
09F14
09F15
09F16
09G01
09G02
09G03
09G04
09G05
09G06
09G07
09G08
09G09
09G10
09G11
09G12
09G13
09G14
09G15
09G16
09H01
09H02
09H03
09H04
09H05
09H06
09H07
09H08
09H09
09H10
09H11
09H12
09H13
09H14
09H15
09H16
10A01
10A02
10A03
10A04
10A05
10A06
10A07
10A08
10A09
10A10
10A11
10A12
10A13
10A14
10A15
10A16
10B01
10B02
10B03
10B04
10B05
10B06
10B07
10B08
10B09
10B10
10B11
10B12
10B13
10B14
10B15
10B16
10C01
10C02
10C03
10C04
10C05
10C06
10C07
10C08
10C09
10C10
10C11
10C12
10C13
10C14
10C15
10C16
10D01
10D02
10D03
10D04
10D05
10D06
10D07
10D08
10D09
10D10
10D11
10D12
10D13
10D14
10D15
10D16
10E01
10E02
10E03
10E04
10E05
10E06
10E07
10E08
10E09
10E10
10E11
10E12
10E13
10E14
10E15
10E16
10F01
10F02
10F03
10F04
10F05
10F06
10F07
10F08
10F09
10F10
10F11
10F12
10F13
10F14
10F15
10F16
10G01
10G02
10G03
10G04
10G05
10G06
10G07
10G08
10G09
10G10
10G11
10G12
10G13
10G14
10G15
10G16
10H01
10H02
10H03
10H04
10H05
10H06
10H07
10H08
10H09
10H10
10H11
10H12
10H13
10H14
10H15
10H16
11A01
11A02
11A03
11A04
11A05
11A06
11A07
11A08
11A09
11A10
11A11
11A12
11A13
11A14
11A15
11A16
11B01
11B02
11B03
11B04
11B05
11B06
11B07
11B08
11B09
11B10
11B11
11B12
11B13
11B14
11B15
11B16
11C01
11C02
11C03
11C04
11C05
11C06
11C07
11C08
11C09
11C10
11C11
11C12
11C13
11C14
11C15
11C16
11D01
11D02
11D03
11D04
11D05
11D06
11D07
11D08
11D09
11D10
11D11
11D12
11D13
11D14
11D15
11D16
11E01
11E02
11E03
11E04
11E05
11E06
11E07
11E08
11E09
11E10
11E11
11E12
11E13
11E14
11E15
11E16
11F01
11F02
11F03
11F04
11F05
11F06
11F07
11F08
11F09
11F10
11F11
11F12
11F13
11F14
11F15
11F16
11G01
11G02
11G03
11G04
11G05
11G06
11G07
11G08
11G09
11G10
11G11
11G12
11G13
11G14
11G15
11G16
11H01
11H02
11H03
11H04
11H05
11H06
11H07
11H08
11H09
11H10
11H11
11H12
11H13
11H14
11H15
11H16
12A01
12A02
12A03
12A04
12A05
12A06
12A07
12A08
12A09
12A10
12A11
12A12
12A13
12A14
12A15
12A16
12B01
12B02
12B03
12B04
12B05
12B06
12B07
12B08
12B09
12B10
12B11
12B12
12B13
12B14
12B15
12B16
12C01
12C02
12C03
12C04
12C05
12C06
12C07
12C08
12C09
12C10
12C11
12C12
12C13
12C14
12C15
12C16
12D01
12D02
12D03
12D04
12D05
12D06
12D07
12D08
12D09
12D10
12D11
12D12
12D13
12D14
12D15
12D16
12E01
12E02
12E03
12E04
12E05
12E06
12E07
12E08
12E09
12E10
12E11
12E12
12E13
12E14
12E15
12E16
12F01
12F02
12F03
12F04
12F05
12F06
12F07
12F08
12F09
12F10
12F11
12F12
12F13
12F14
12F15
12F16
12G01
12G02
12G03
12G04
12G05
12G06
12G07
12G08
12G09
12G10
12G11
12G12
12G13
12G14
12G15
12G16
12H01
12H02
12H03
12H04
12H05
12H06
12H07
12H08
12H09
12H10
12H11
12H12
12H13
12H14
12H15
12H16
13A01
13A02
13A03
13A04
13A05
13A06
13A07
13A08
13A09
13A10
13A11
13A12
13A13
13A14
13A15
13A16
13B01
13B02
13B03
13B04
13B05
13B06
13B07
13B08
13B09
13B10
13B11
13B12
13B13
13B14
13B15
13B16
13C01
13C02
13C03
13C04
13C05
13C06
13C07
13C08
13C09
13C10
13C11
13C12
13C13
13C14
13C15
13C16
13D01
13D02
13D03
13D04
13D05
13D06
13D07
13D08
13D09
13D10
13D11
13D12
13D13
13D14
13D15
13D16
13E01
13E02
13E03
13E04
13E05
13E06
13E07
13E08
13E09
13E10
13E11
13E12
13E13
13E14
13E15
13E16
13F01
13F02
13F03
13F04
13F05
13F06
13F07
13F08
13F09
13F10
13F11
13F12
13F13
13F14
13F15
13F16
13G01
13G02
13G03
13G04
13G05
13G06
13G07
13G08
13G09
13G10
13G11
13G12
13G13
13G14
13G15
13G16
13H01
13H02
13H03
13H04
13H05
13H06
13H07
13H08
13H09
13H10
13H11
13H12
13H13
13H14
13H15
13H16
14A01
14A02
14A03
14A04
14A05
14A06
14A07
14A08
14A09
14A10
14A11
14A12
14A13
14A14
14A15
14A16
14B01
14B02
14B03
14B04
14B05
14B06
14B07
14B08
14B09
14B10
14B11
14B12
14B13
14B14
14B15
14B16
14C01
14C02
14C03
14C04
14C05
14C06
14C07
14C08
14C09
14C10
14C11
14C12
14C13
14C14
14C15
14C16
14D01
14D02
14D03
14D04
14D05
14D06
14D07
14D08
14D09
14D10
14D11
14D12
14D13
14D14
14D15
14D16
14E01
14E02
14E03
14E04
14E05
14E06
14E07
14E08
14E09
14E10
14E11
14E12
14E13
14E14
14E15
14E16
14F01
14F02
14F03
14F04
14F05
14F06
14F07
14F08
14F09
14F10
14F11
14F12
14F13
14F14
14F15
14F16
14G01
14G02
14G03
14G04
14G05
14G06
14G07
14G08
14G09
14G10
14G11
14G12
14G13
14G14
14G15
14G16
14H01
14H02
14H03
14H04
14H05
14H06
14H07
14H08
14H09
14H10
14H11
14H12
14H13
14H14
14H15
14H16
15A01
15A02
15A03
15A04
15A05
15A06
15A07
15A08
15A09
15A10
15A11
15A12
15A13
15A14
15A15
15A16
15B01
15B02
15B03
15B04
15B05
15B06
15B07
15B08
15B09
15B10
15B11
15B12
15B13
15B14
15B15
15B16
15C01
15C02
15C03
15C04
15C05
15C06
15C07
15C08
15C09
15C10
15C11
15C12
15C13
15C14
15C15
15C16
15D01
15D02
15D03
15D04
15D05
15D06
15D07
15D08
15D09
15D10
15D11
15D12
15D13
15D14
15D15
15D16
15E01
15E02
15E03
15E04
15E05
15E06
15E07
15E08
15E09
15E10
15E11
15E12
15E13
15E14
15E15
15E16
15F01
15F02
15F03
15F04
15F05
15F06
15F07
15F08
15F09
15F10
15F11
15F12
15F13
15F14
15F15
15F16
15G01
15G02
15G03
15G04
15G05
15G06
15G07
15G08
15G09
15G10
15G11
15G12
15G13
15G14
15G15
15G16
15H01
15H02
15H03
15H04
15H05
15H06
15H07
15H08
15H09
15H10
15H11
15H12
15H13
15H14
15H15
15H16
16A01
16A02
16A03
16A04
16A05
16A06
16A07
16A08
16A09
16A10
16A11
16A12
16A13
16A14
16A15
16A16
16B01
16B02
16B03
16B04
16B05
16B06
16B07
16B08
16B09
16B10
16B11
16B12
16B13
16B14
16B15
16B16
16C01
16C02
16C03
16C04
16C05
16C06
16C07
16C08
16C09
16C10
16C11
16C12
16C13
16C14
16C15
16C16
16D01
16D02
16D03
16D04
16D05
16D06
16D07
16D08
16D09
16D10
16D11
16D12
16D13
16D14
16D15
16D16
16E01
16E02
16E03
16E04
16E05
16E06
16E07
16E08
16E09
16E10
16E11
16E12
16E13
16E14
16E15
16E16
16F01
16F02
16F03
16F04
16F05
16F06
16F07
16F08
16F09
16F10
16F11
16F12
16F13
16F14
16F15
16F16
16G01
16G02
16G03
16G04
16G05
16G06
16G07
16G08
16G09
16G10
16G11
16G12
16G13
16G14
16G15
16G16
16H01
16H02
16H03
16H04
16H05
16H06
16H07
16H08
16H09
16H10
16H11
16H12
16H13
16H14
16H15
16H16
17A01
17A02
17A03
17A04
17A05
17A06
17A07
17A08
17A09
17A10
17A11
17A12
17A13
17A14
17A15
17A16
17B01
17B02
17B03
17B04
17B05
17B06
17B07
17B08
17B09
17B10
17B11
17B12
17B13
17B14
17B15
17B16
17C01
17C02
17C03
17C04
17C05
17C06
17C07
17C08
17C09
17C10
17C11
17C12
17C13
17C14
17C15
17C16
17D01
17D02
17D03
17D04
17D05
17D06
17D07
17D08
17D09
17D10
17D11
17D12
17D13
17D14
17D15
17D16
17E01
17E02
17E03
17E04
17E05
17E06
17E07
17E08
17E09
17E10
17E11
17E12
17E13
17E14
17E15
17E16
17F01
17F02
17F03
17F04
17F05
17F06
17F07
17F08
17F09
17F10
17F11
17F12
17F13
17F14
17F15
17F16
17G01
17G02
17G03
17G04
17G05
17G06
17G07
17G08
17G09
17G10
17G11
17G12
17G13
17G14
17G15
17G16
17H01
17H02
17H03
17H04
17H05
17H06
17H07
17H08
17H09
17H10
17H11
17H12
17H13
17H14
17H15
17H16
18A01
18A02
18A03
18A04
18A05
18A06
18A07
18A08
18A09
18A10
18A11
18A12
18A13
18A14
18A15
18A16
18B01
18B02
18B03
18B04
18B05
18B06
18B07
18B08
18B09
18B10
18B11
18B12
18B13
18B14
18B15
18B16
18C01
18C02
18C03
18C04
18C05
18C06
18C07
18C08
18C09
18C10
18C11
18C12
18C13
18C14
18C15
18C16
18D01
18D02
18D03
18D04
18D05
18D06
18D07
18D08
18D09
18D10
18D11
18D12
18D13
18D14
18D15
18D16
18E01
18E02
18E03
18E04
18E05
18E06
18E07
18E08
18E09
18E10
18E11
18E12
18E13
18E14
18E15
18E16
18F01
18F02
18F03
18F04
18F05
18F06
18F07
18F08
18F09
18F10
18F11
18F12
18F13
18F14
18F15
18F16
18G01
18G02
18G03
18G04
18G05
18G06
18G07
18G08
18G09
18G10
18G11
18G12
18G13
18G14
18G15
18G16
18H01
18H02
18H03
18H04
18H05
18H06
18H07
18H08
18H09
18H10
18H11
18H12
18H13
18H14
18H15
18H16
19A01
19A02
19A03
19A04
19A05
19A06
19A07
19A08
19A09
19A10
19A11
19A12
19A13
19A14
19A15
19A16
19B01
19B02
19B03
19B04
19B05
19B06
19B07
19B08
19B09
19B10
19B11
19B12
19B13
19B14
19B15
19B16
19C01
19C02
19C03
19C04
19C05
19C06
19C07
19C08
19C09
19C10
19C11
19C12
19C13
19C14
19C15
19C16
19D01
19D02
19D03
19D04
19D05
19D06
19D07
19D08
19D09
19D10
19D11
19D12
19D13
19D14
19D15
19D16
19E01
19E02
19E03
19E04
19E05
19E06
19E07
19E08
19E09
19E10
19E11
19E12
19E13
19E14
19E15
19E16
19F01
19F02
19F03
19F04
19F05
19F06
19F07
19F08
19F09
19F10
19F11
19F12
19F13
19F14
19F15
19F16
19G01
19G02
19G03
19G04
19G05
19G06
19G07
19G08
19G09
19G10
19G11
19G12
19G13
19G14
19G15
19G16
19H01
19H02
19H03
19H04
19H05
19H06
19H07
19H08
19H09
19H10
19H11
19H12
19H13
19H14
19H15
19H16
20A01
20A02
20A03
20A04
20A05
20A06
20A07
20A08
20A09
20A10
20A11
20A12
20A13
20A14
20A15
20A16
20B01
20B02
20B03
20B04
20B05
20B06
20B07
20B08
20B09
20B10
20B11
20B12
20B13
20B14
20B15
20B16
20C01
20C02
20C03
20C04
20C05
20C06
20C07
20C08
20C09
20C10
20C11
20C12
20C13
20C14
20C15
20C16
20D01
20D02
20D03
20D04
20D05
20D06
20D07
20D08
20D09
20D10
20D11
20D12
20D13
20D14
20D15
20D16
20E01
20E02
20E03
20E04
20E05
20E06
20E07
20E08
20E09
20E10
20E11
20E12
20E13
20E14
20E15
20E16
20F01
20F02
20F03
20F04
20F05
20F06
20F07
20F08
20F09
20F10
20F11
20F12
20F13
20F14
20F15
20F16
20G01
20G02
20G03
20G04
20G05
20G06
20G07
20G08
20G09
20G10
20G11
20G12
20G13
20G14
20G15
20G16
20H01
20H02
20H03
20H04
20H05
20H06
20H07
20H08
20H09
20H10
20H11
20H12
20H13
20H14
20H15
20H16
21A01
21A02
21A03
21A04
21A05
21A06
21A07
21A08
21A09
21A10
21A11
21A12
21A13
21A14
21A15
21A16
21B01
21B02
21B03
21B04
21B05
21B06
21B07
21B08
21B09
21B10
21B11
21B12
21B13
21B14
21B15
21B16
21C01
21C02
21C03
21C04
21C05
21C06
21C07
21C08
21C09
21C10
21C11
21C12
21C13
21C14
21C15
21C16
21D01
21D02
21D03
21D04
21D05
21D06
21D07
21D08
21D09
21D10
21D11
21D12
21D13
21D14
21D15
21D16
21E01
21E02
21E03
21E04
21E05
21E06
21E07
21E08
21E09
21E10
21E11
21E12
21E13
21E14
21E15
21E16
21F01
21F02
21F03
21F04
21F05
21F06
21F07
21F08
21F09
21F10
21F11
21F12
21F13
21F14
21F15
21F16
21G01
21G02
21G03
21G04
21G05
21G06
21G07
21G08
21G09
21G10
21G11
21G12
21G13
21G14
21G15
21G16
21H01
21H02
21H03
21H04
21H05
21H06
21H07
21H08
21H09
21H10
21H11
21H12
21H13
21H14
21H15
21H16
22A01
22A02
22A03
22A04
22A05
22A06
22A07
22A08
22A09
22A10
22A11
22A12
22A13
22A14
22A15
22A16
22B01
22B02
22B03
22B04
22B05
22B06
22B07
22B08
22B09
22B10
22B11
22B12
22B13
22B14
22B15
22B16
22C01
22C02
22C03
22C04
22C05
22C06
22C07
22C08
22C09
22C10
22C11
22C12
22C13
22C14
22C15
22C16
22D01
22D02
22D03
22D04
22D05
22D06
22D07
22D08
22D09
22D10
22D11
22D12
22D13
22D14
22D15
22D16
22E01
22E02
22E03
22E04
22E05
22E06
22E07
22E08
22E09
22E10
22E11
22E12
22E13
22E14
22E15
22E16
22F01
22F02
22F03
22F04
22F05
22F06
22F07
22F08
22F09
22F10
22F11
22F12
22F13
22F14
22F15
22F16
22G01
22G02
22G03
22G04
22G05
22G06
22G07
22G08
22G09
22G10
22G11
22G12
22G13
22G14
22G15
22G16
22H01
22H02
22H03
22H04
22H05
22H06
22H07
22H08
22H09
22H10
22H11
22H12
22H13
22H14
22H15
22H16
23A01
23A02
23A03
23A04
23A05
23A06
23A07
23A08
23A09
23A10
23A11
23A12
23A13
23A14
23A15
23A16
23B01
23B02
23B03
23B04
23B05
23B06
23B07
23B08
23B09
23B10
23B11
23B12
23B13
23B14
23B15
23B16
23C01
23C02
23C03
23C04
23C05
23C06
23C07
23C08
23C09
23C10
23C11
23C12
23C13
23C14
23C15
23C16
23D01
23D02
23D03
23D04
23D05
23D06
23D07
23D08
23D09
23D10
23D11
23D12
23D13
23D14
23D15
23D16
23E01
23E02
23E03
23E04
23E05
23E06
23E07
23E08
23E09
23E10
23E11
23E12
23E13
23E14
23E15
23E16
23F01
23F02
23F03
23F04
23F05
23F06
23F07
23F08
23F09
23F10
23F11
23F12
23F13
23F14
23F15
23F16
23G01
23G02
23G03
23G04
23G05
23G06
23G07
23G08
23G09
23G10
23G11
23G12
23G13
23G14
23G15
23G16
23H01
23H02
23H03
23H04
23H05
23H06
23H07
23H08
23H09
23H10
23H11
23H12
23H13
23H14
23H15
23H16
24A01
24A02
24A03
24A04
24A05
24A06
24A07
24A08
24A09
24A10
24A11
24A12
24A13
24A14
24A15
24A16
24B01
24B02
24B03
24B04
24B05
24B06
24B07
24B08
24B09
24B10
24B11
24B12
24B13
24B14
24B15
24B16
24C01
24C02
24C03
24C04
24C05
24C06
24C07
24C08
24C09
24C10
24C11
24C12
24C13
24C14
24C15
24C16
24D01
24D02
24D03
24D04
24D05
24D06
24D07
24D08
24D09
24D10
24D11
24D12
24D13
24D14
24D15
24D16
24E01
24E02
24E03
24E04
24E05
24E06
24E07
24E08
24E09
24E10
24E11
24E12
24E13
24E14
24E15
24E16
24F01
24F02
24F03
24F04
24F05
24F06
24F07
24F08
24F09
24F10
24F11
24F12
24F13
24F14
24F15
24F16
24G01
24G02
24G03
24G04
24G05
24G06
24G07
24G08
24G09
24G10
24G11
24G12
24G13
24G14
24G15
24G16
24H01
24H02
24H03
24H04
24H05
24H06
24H07
24H08
24H09
24H10
24H11
24H12
24H13
24H14
24H15
24H16
25A01
25A02
25A03
25A04
25A05
25A06
25A07
25A08
25A09
25A10
25A11
25A12
25A13
25A14
25A15
25A16
25B01
25B02
25B03
25B04
25B05
25B06
25B07
25B08
25B09
25B10
25B11
25B12
25B13
25B14
25B15
25B16
25C01
25C02
25C03
25C04
25C05
25C06
25C07
25C08
25C09
25C10
25C11
25C12
25C13
25C14
25C15
25C16
25D01
25D02
25D03
25D04
25D05
25D06
25D07
25D08
25D09
25D10
25D11
25D12
25D13
25D14
25D15
25D16
25E01
25E02
25E03
25E04
25E05
25E06
25E07
25E08
25E09
25E10
25E11
25E12
25E13
25E14
25E15
25E16
25F01
25F02
25F03
25F04
25F05
25F06
25F07
25F08
25F09
25F10
25F11
25F12
25F13
25F14
25F15
25F16
25G01
25G02
25G03
25G04
25G05
25G06
25G07
25G08
25G09
25G10
25G11
25G12
25G13
25G14
25G15
25G16
25H01
25H02
25H03
25H04
25H05
25H06
25H07
25H08
25H09
25H10
25H11
25H12
25H13
25H14
25H15
25H16
26A01
26A02
26A03
26A04
26A05
26A06
26A07
26A08
26A09
26A10
26A11
26A12
26A13
26A14
26A15
26A16
26B01
26B02
26B03
26B04
26B05
26B06
26B07
26B08
26B09
26B10
26B11
26B12
26B13
26B14
26B15
26B16
26C01
26C02
26C03
26C04
26C05
26C06
26C07
26C08
26C09
26C10
26C11
26C12
26C13
26C14
26C15
26C16
26D01
26D02
26D03
26D04
26D05
26D06
26D07
26D08
26D09
26D10
26D11
26D12
26D13
26D14
26D15
26D16
26E01
26E02
26E03
26E04
26E05
26E06
26E07
26E08
26E09
26E10
26E11
26E12
26E13
26E14
26E15
26E16
26F01
26F02
26F03
26F04
26F05
26F06
26F07
26F08
26F09
26F10
26F11
26F12
26F13
26F14
26F15
26F16
26G01
26G02
26G03
26G04
26G05
26G06
26G07
26G08
26G09
26G10
26G11
26G12
26G13
26G14
26G15
26G16
26H01
26H02
26H03
26H04
26H05
26H06
26H07
26H08
26H09
26H10
26H11
26H12
26H13
26H14
26H15
26H16
By default line 4 in Serialization file.txt will always be the first position and by default is generally "01A01". I need an option to start at a different position like "01C01" for example. To have "01C01" on text line 4 in Serialization file.txt I'll need the batch file to delete the correct lines "01A01 through 01B16".

In other words the goal is to have a user input 5 character "XXXXX" to text line 4 in the Serialization file.txt (where "01A01" is on line 4 by default) and to delete all lines necessary to have "XXXXX" placed at line 4 (position one) while keeping the same file organization after "XXXXX". Confirm that's what the user wanted - just like the work order entry - besides allowing characters and integers.

Thank you in advance for anyone trying to help me out on this I know this is a lot and will highly appreciate any help.

T3RRY
Posts: 83
Joined: 06 May 2020 10:14

Re: Batch File to edit specific line of Text file

#26 Post by T3RRY » 16 Oct 2020 14:42

werejago wrote:
16 Oct 2020 11:38
I have a dyer request. I'm having trouble modifying the code below and I'm trying to add a modification.


The first Completed objective is to have a user input an "8 digit work order number" into a command prompt to edit line 2 in "Serilization file.txt".

Now...the next objective is to slightly modify how the user is prompt; to be able to start in any position on text line 4 (ex. position: 01A01 through 26H16) in the "Serilization file.txt" (another program uses Serilization file.txt as a reference point on which position it's on).

Ex. I already have this:
User clicks .bat file to automate a cmd prompt window to ask user for, "8 digit work order number" and to enter "Y/N" to confirm.
The current code that successfully modifies the "8 digit work order number" (text line 2) in the "Serialization file.txt" is below.

Code: Select all

@echo off & Goto :Main
rem /*_________________________________________Functions; sets parameters, sets input, verfies input to parameters */
:GetIN
 Setlocal EnableDelayedExpansion
 Set "Input=(Set "nVar="&Echo/Enter # Digit Work Order:&(For /L %%. in (1 1 #)Do For /F "Delims=" %%G in ('Choice /N /C 0123456789')Do (<Nul Set /P"=%%G"&Set "nvar=^^!nVar^^!%%G"))&Echo/&Echo/Confirm: ^^!nVar^^! Y/N & For /F "Delims=" %%v in ('Choice /N')Do (If /I "%%~v"=="n" (Goto :retry)))"
:retry
 %Input:#=8% & Echo/Var [!nVar!] Confirmed
 Endlocal & Set "%1=%nVar%" 2> Nul
Exit /B 0

rem /*_________________________________________Script Body; reads/writes to Serialization.txt line 2 */ 
:Main
set "file=Sensor Serialization.txt"
<"%file%" set /p "line1="
Call :GetIn Num
setlocal EnableDelayedExpansion
>"!file!.~tmp" echo(!line1!
>>"!file!.~tmp" echo(!num!
<"!file!" >>"!file!.~tmp" more +2
move /y "!file!.~tmp" "!file!"
Endlocal
AFTER this instead of ending I want to ask the user, "Start from beginning? Y/N" if "Y" then it continues script as normal.

IF "N" then it prompts user to enter the starting point (ex. 01A01 through 26H16) in the "Serilization file.txt", while still modifying the previously entered "8 digit work order number" in "Serilization file.txt" as usual.

Ex. User inputs "N" for "Starting from the beginning?"
Prompt asks user to "enter starting position", user inputs starting position, "01G01", for example.
I want to delete all lines between position 01A01 through 01F16 (to insure we're at text line "01G01" in "Serilization file.txt" and save as usual.

By default line 4 in Serialization file.txt will always be the first position and by default is generally "01A01". I need an option to start at a different position like "01C01" for example. To have "01C01" on text line 4 in Serialization file.txt I'll need the batch file to delete the correct lines "01A01 through 01B16".

In other words the goal is to have a user input 5 character "XXXXX" to text line 4 in the Serialization file.txt (where "01A01" is on line 4 by default) and to delete all lines necessary to have "XXXXX" placed at line 4 (position one) while keeping the same file organization after "XXXXX". Confirm that's what the user wanted - just like the work order entry - besides allowing characters and integers.

Thank you in advance for anyone trying to help me out on this I know this is a lot and will highly appreciate any help.
The below will essentially do what you ask, however, what you ask conflicts with the instructions contained in the file you seek to modify.
In other words the goal is to have a user input 5 character "XXXXX" to text line 4 in the Serialization file.txt (where "01A01" is on line 4 by default) and to delete all lines necessary to have "XXXXX" placed at line 4 (position one) while keeping the same file organization after "XXXXX". Confirm that's what the user wanted - just like the work order entry - besides allowing characters and integers.
Yet...
Begin sensor serializaitons, DO NOT change information on Line 3 or beyond.
It's entirely possible to iterate over the numbers after the entered Serial number and use a T/F flag to reject all numbers that preceede the selected number, without deleting them from the file. - This is how the 'deletion' of the numbers from the file is enacted - by using a TF flag to indicate if the selected number has been encountered yet, and only output numbers after that condition is met.

Code: Select all

@echo off & CD "%~dp0" & Goto :Main
rem /*_________________________________________Functions; sets parameters, sets input, verfies input to parameters */
:GetIN [ReturnVar] [Length] [Allowed Characters] [Format]
Setlocal EnableDelayedExpansion
Set "Input=(Set "nVar="&Echo/Enter %2 Digit %1 %4:&(For /L %%. in (1 1 %2)Do For /F "Delims=" %%G in ('Choice /N /C %3')Do (<Nul Set /P"=%%G"&Set "nvar=^^!nVar^^!%%G"))&Echo/&Echo/Confirm: ^^!nVar^^! Y/N & For /F "Delims=" %%v in ('Choice /N')Do (If /I "%%~v"=="n" (Goto :retry)))"
:retry
%Input% & Echo/%1 [!nVar!] Confirmed
Endlocal & Set "%1=%nVar%" 2> Nul
Exit /B 0
:UpdateWO
 <"!file!" set /p "line1="
 >"!file!.~tmp" Echo/!line1!
 >>"!file!.~tmp" echo/!#WO!
 <"!file!" >>"!file!.~tmp" more +2
 move /y "!file!.~tmp" "!file!"
Exit /B
:UpdateSER
 <"!File!" (
  Set /P "Line[1]="
  Set /P "Line[2]="
  Set /P "Line[3]="
 )
 >"!File!.~tmp" (
  Echo/!Line[1]!
  Echo/!Line[2]!
  Echo/!Line[3]!
  Echo/!#SER!
 )
 rem /* the below acts upon entries after the entered #SER */
Set "Start=F"
(For /F "UsebackQ Skip=3 Delims=" %%G in ("!File!")Do If not "%%~G" == "!#SER!" (If "!Start!" == "T" (Echo/%%~G))Else Set "Start=T") >>"%File%.~tmp"
move /y "!file!.~tmp" "!file!"
Exit /B
rem /*_________________________________________Script Body; reads/writes to Serialization.txt line 2 */ 
:Main
Set "Menu=Echo/[R]epeat [C]ontinue [E]xit&For /F "Delims=" %%G in ('Choice /N /C:RCE')Do If "%%G"=="R" ( Goto :lbl )Else If "%%G"=="E" (Endlocal & Exit /B 0)"
setlocal EnableDelayedExpansion
:WorkOrder
set "file=Sensor Serialization.txt"
Call :GetIn #WO 8 0123456789
rem /* Call function to update workorder # in file */
Call :UpdateWO
%menu:lbl=WorkOrder%
:Serial
Call :GetIn #SER 5 0123456789ABCDEFGH {[01-26][A-H][01-16]}
Call :UpdateSer
%menu:lbl=Serial%
rem /* Additions to your script should occur before this Endlocal */
Endlocal

werejago
Posts: 21
Joined: 01 Oct 2020 07:43

Re: Batch File to edit specific line of Text file

#27 Post by werejago » 16 Oct 2020 15:08

T3rry I'm sorry for the confusion but to clarify:

The comment, "Begin sensor serializations, DO NOT change information on Line 3 or beyond." is to be ignored by us.

Thank you very much for your assistance! I'll test it out more thoroughly when I can though so far I really like what you did.

werejago
Posts: 21
Joined: 01 Oct 2020 07:43

Re: Batch File to edit specific line of Text file

#28 Post by werejago » 16 Oct 2020 15:36

Hmm T3rry I thought I had successfully ran your script but now that I tried combining it with the rest of my source I'm running into an issue with ALL text lines being deleted AFTER the saved input of my starting position.

werejago
Posts: 21
Joined: 01 Oct 2020 07:43

Re: Batch File to edit specific line of Text file

#29 Post by werejago » 16 Oct 2020 15:56

Do you see any errors in this script that could cause a deletion of all positions after the input of "XXXXX" for exact position.

Code: Select all

@echo off
rem /*_________________________________________Deletes all Files in folder besides itself or other folders */ 
9>>"%~f0" (>nul 2>&1 del /f /q *.*)

rem /*_________________________________________Copies files from Master Files folder and renames designated files */ 
xcopy "Z:\Production\Cell 3 and 4\Laser Engraver Master Files" "Z:\Users\Wesley Kirk\LaserBAT\Barcode Serialization Files" 
rename "Sensor Engraving Master File.EZD" "Sensor Engraving.EZD"
rename "Sensor Serialization Master File.txt" "Sensor Serialization.txt"

@echo off & CD "%~dp0" & Goto :Main
rem /*_________________________________________Functions; sets parameters, sets input, verfies input to parameters */
:GetIN [ReturnVar] [Length] [Allowed Characters] [Format]
Setlocal EnableDelayedExpansion
Set "Input=(Set "nVar="&Echo/Enter %2 Digit %1 %4:&(For /L %%. in (1 1 %2)Do For /F "Delims=" %%G in ('Choice /N /C %3')Do (<Nul Set /P"=%%G"&Set "nvar=^^!nVar^^!%%G"))&Echo/&Echo/Confirm: ^^!nVar^^! Y/N & For /F "Delims=" %%v in ('Choice /N')Do (If /I "%%~v"=="n" (Goto :retry)))"
:retry
%Input% & Echo/%1 [!nVar!] Confirmed
Endlocal & Set "%1=%nVar%" 2> Nul
Exit /B 0
:UpdateWO
 <"!file!" set /p "line1="
 >"!file!.~tmp" Echo/!line1!
 >>"!file!.~tmp" echo/!#WO!
 <"!file!" >>"!file!.~tmp" more +2
 move /y "!file!.~tmp" "!file!"
Exit /B
:UpdateSER
 <"!File!" (
  Set /P "Line[1]="
  Set /P "Line[2]="
  Set /P "Line[3]="
 )
 >"!File!.~tmp" (
  Echo/!Line[1]!
  Echo/!Line[2]!
  Echo/!Line[3]!
  Echo/!#SER!
 )
 rem /* the below acts upon entries after the entered #SER */
Set "Start=F"
(For /F "UsebackQ Skip=3 Delims=" %%G in ("!File!")Do If not "%%~G" == "!#SER!" (If "!Start!" == "T" (Echo/%%~G))Else Set "Start=T") >>"%File%.~tmp"
move /y "!file!.~tmp" "!file!"
Exit /B
rem /*_________________________________________Script Body; reads/writes to Serialization.txt line 2 */ 
:Main
Set "Menu=Echo/[R]epeat [C]ontinue [E]xit&For /F "Delims=" %%G in ('Choice /N /C:RCE')Do If "%%G"=="R" ( Goto :lbl )Else If "%%G"=="E" (Endlocal & Exit /B 0)"
setlocal EnableDelayedExpansion
:WorkOrder
set "file=Sensor Serialization.txt"
Call :GetIn #WO 8 0123456789
rem /* Call function to update workorder # in file */
Call :UpdateWO
%menu:lbl=WorkOrder%
:Serial
Call :GetIn #SER 5 0123456789ABCDEFGH {[01-26][A-H][01-16]}
Call :UpdateSer
%menu:lbl=Serial%
rem /* Additions to your script should occur before this Endlocal */
Endlocal




rem /*_________________________________________Starts notepad/ezcad2, opens Serialization.txt/sensor engraving.ezd to verify workorder number  */ 
start notepad "Sensor Serialization.txt"

rem /*start C:\Users\ptech\Documents\Ezcad2.14.9(20170509)\Ezcad2.exe "Sensor Engraving.EZD"*/


werejago
Posts: 21
Joined: 01 Oct 2020 07:43

Re: Batch File to edit specific line of Text file

#30 Post by werejago » 16 Oct 2020 16:14

Hey T3rry after testing it out again I didn't run into the same issue I'm thinking I had the wrong directory that was causing my previous issue.
I can't thank you enough for all the help. I'll get back to you after further testing. Also, are you involved with cryptocurrency? I would love to tip you for your efforts.

Thanks again.

Post Reply