computing
  • 5

Remove Empty Line Using Batch Command

  • 5

Hi,

I am having data file like below, where there are lot of empty lines (only separates are there). I want to remove those empty line using some batch command. Can you please help. Also I am trying to avoid to read line-by-line as the actual files are having million of lines.

1,,3,abc,ac,aw,q
1,2,3,,,,q
1,2,qq3,abc,4ac,2aw1,q
,,,,,,
,,,,,,
,,,,,,
,,,,,,
,,,,,,
,,,,,,
,,,,,,
,,,,,,
,,,,,,
,,,,,,

Thanks in advance for the help.

Share

1 Answer

  1. This is another way. It too reads the file line by line but with batch scripting thats the only way its going to work. Perhaps try the vbscript forum for the result you are looking for.

    for /f %%A in (oldfile) do (if NOT "%%A"==",,,,,," (echo %%A>>newfile))
    

    • 0