home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch      Fun with MS-DOS batch files      42,547 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 42,165 of 42,547   
   Andy Burnelli to Herbert Kleebauer   
   Re: Lower case and diff two text files c   
   24 Mar 23 03:35:01   
   
   XPost: alt.comp.os.windows-10, alt.comp.microsoft.windows   
   From: nospam@nospam.net   
      
   Herbert Kleebauer wrote:   
      
   >   23.03.2023 19:31, Maxmillian wrote:   
   >> I have two long lists of email addresses in Windows 10 as text files.   
   >>   
   >> How can I lowercase everything and then get a diff of what email   
   >> addresses are in one text file but not in the other text file?   
   >   
   > Because you posted in alt.msdos.batch, here a batch solution:   
   >   
   > @echo off   
   >   
   >:: list all email addresses which are not in both   
   >:: input files (email1.txt, email2.txt)   
   >   
   > if [%1]==[sub] goto :sub   
   > sort email1.txt|find "@" >email1s.txt   
   > sort email2.txt|find "@" >email2s.txt   
   > cmd /c %0 sub   
   > del email1s.txt   
   > del email2s.txt   
   > goto :eof   
   >   
   >:sub   
   > setlocal EnableDelayedExpansion   
   >   
   > 3   set line1a=&set /P line1a=<&3   
   >   set line2a=&set /P line2a=<&4   
   >   set line1b=&set /P line1b=<&3   
   >   set line2b=&set /P line2b=<&4   
   >   
   >   for /l %%i in (1,1,100000) do (   
   >   if /I [!line1a!]==[!line2a!] (   
   >      if [!line1a!]==[] exit   
   >      set line1a=!line1b!   
   >      set line2a=!line2b!   
   >      set line1b=&set /P line1b=<&3   
   >      set line2b=&set /P line2b=<&4   
   >      ) else (   
   >        if /I [!line1a!]==[!line2b!] (   
   >          echo !line2a! in email2.txt but not in email1.txt   
   >          set line2a=!line2b!   
   >          set line2b=&set /P line2b=<&4   
   >          ) else (   
   >            if /I [!line1b!]==[!line2a!] (   
   >              echo !line1a! in email1.txt but not in email2.txt   
   >              set line1a=!line1b!   
   >              set line1b=&set /P line1b=<&3   
   >              ) else (   
   >                echo !line1a! in email1.txt but not in email2.txt   
   >                echo !line2a! in email2.txt but not in email1.txt   
   >                set line1a=!line1b!   
   >                set line2a=!line2b!   
   >                set line1b=&set /P line1b=<&3   
   >                set line2b=&set /P line2b=<&4   
   >              )   
   >          )   
   >      )   
   >   )   
   > )   
      
   That is just sheer genius.   
      
   You should win a nobel prize for that as a diff has been the bane of   
   Windows users for years!   
      
   It's going into my batch folder immediately!   
      
   --- 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