Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.msdos.batch.nt    |    Fun with Windows NT batch files    |    68,980 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 68,417 of 68,980    |
|    Zaidy036 to Herbert Kleebauer    |
|    Re: Replace line in a txt file with miss    |
|    10 Jan 24 15:59:30    |
   
   From: Zaidy036@air.isp.spam   
      
   On 1/10/2024 1:30 PM, Herbert Kleebauer wrote:   
   > On 10.01.2024 18:14, Zaidy036 wrote:   
   >   
   >> That complication is so the batch can do multiple runs but still ID data   
   >> to review. I will simplify with "outside" run numbering and renaming   
   >> data files after the main part of the batch like:   
   >>   
   >> SET _NN=0   
   >> :_DoIt   
   >> SET /A _NN=%_NN% + 1   
   >> [ batch cmds without %_NN% ]   
   >> [ REN F:\xxxx.xxx to %_NN%xxxx.xxx ]   
   >> [ run again will be manual using CHOICE GOTO _DoIt]   
   >>   
   >   
   > Just tell us, what you really want to do. You said you have   
   > an input file like:   
   >   
   > My sample.txt is similar to the following up to 50 lines:   
   > SSID 1 : Residents 5   
   > SSID 2 : HSL2   
   > SSID 3 : AscomI62   
   > SSID 4 : Guest   
   > SSID 5 : ResidentsA   
   > SSID 6 : ResidentsB   
   > SSID 7 :   
   > SSID 8 : XFINITY   
   > SSID 9 : A440   
   >   
   >   
   > What exactly should the batch do? Generate an output file?   
   > If yes, what should be the content of the output file?   
   >   
   >   
   Sorry but I try to learn and after a failure and searching in vain for a   
   solution I ask here. I build my batches a step at a time ending in ECHO(   
   & CMD /K so I can look at the new results.   
      
   I am not asking here for a complete solution to my goal. The problem is   
   that the input file has SSIDs with blank names which I must fill in a   
   dummy name to eliminate following crashes.   
   - F:\_NW-B.txt is the input file example above   
   - F:\_NW-N.txt is a list of blank SSID names in _NW-B   
      
   I simplified by removal of %_NN% and:   
   - This current last one liner crashes the batch:   
   FOR /F "USEBACKQ TOKENS=1,2 DELIMS=:" %%A IN ("F:\_NW-B.txt") DO (IF   
   "%B"==" " ECHO %%A >> F:\_NW-N.txt)   
      
   - But this one liner works (same but %%A now %A) in Admin-CMD using the   
   batch result files:   
   FOR /F "USEBACKQ TOKENS=1,2 DELIMS=:" %A IN ("F:\_NW-B.txt") DO (IF   
   "%B"==" " ECHO %A >> F:\_NW-N.txt)   
      
   Why does it work in Admin-CMD BUT not in batch?   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca