Results 1 to 2 of 2

Thread: code for using a batch file to parse html (.htm) files and export values in .csv format

  1. #1
    Join Date
    Mar 2011
    Posts
    1

    code for using a batch file to parse html (.htm) files and export values in .csv format

    Can anyone suggest code for using a batch file to parse html (.htm) files and export values in .csv format.

    The values required always appear in the format:

    Applicant No.xxxxx

    and a few lines down

    Call No: xxxxx

    There are multiple .htm files within the folder and I am trying to write a script to output the relevant values in .csv format from all of the files contained.

    Any help would be greatly appreciated, I've been doing it manually getting through a few thousand a day but if I can crack this using a batch file its going to save me loads.

    Cheers Guys,

    James

  2. #2
    Join Date
    Jan 2006
    Posts
    605

    Re: code for using a batch file to parse html (.htm) files and export values in .csv format

    It is always recommended to avoid nested if as they become soon unreadable. So the following code performs what you want in cleaner and more friendly way.

    @Echo Off
    For /f "tokens=2,3 delims= " %%a in (sample.txt) Do (
    If "%%a"=="ADMINS_CAS_SENS" Echo %%a %%b
    If "%%a"=="OLD_PASSWORD" Echo %%a %%b
    )

Similar Threads

  1. run Batch-file export in excel (its for a Movie database)
    By rayg in forum Software Development
    Replies: 4
    Last Post: 22-12-2010, 07:31 PM
  2. Replies: 6
    Last Post: 13-07-2010, 12:29 AM
  3. Batch Script Text file parse
    By tator.usenet@gmail.com in forum Windows Server Help
    Replies: 5
    Last Post: 25-03-2009, 02:12 AM
  4. Batch file to list directories, export to CSV
    By chickenfriedsteak in forum Windows Server Help
    Replies: 1
    Last Post: 16-02-2009, 07:35 PM
  5. Batch Script to parse lines in text file
    By jntoner1@gmail.com in forum Windows Server Help
    Replies: 8
    Last Post: 28-01-2009, 03:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •