batch help

Discussion in 'Scripting' started by NaJeEb303, Jan 12, 2014.

Tags:
  1. NaJeEb303

    NaJeEb303 MDL Novice

    Jul 26, 2013
    4
    0
    0
    hell0 guyz
    i was offline here f0r l0ng time
    s0 i may n0t b called a lurker lol
    btw
    can s0meone plz pr0vide a batch script fr0m which i can rem0ve empty lines fr0m a txt file..

    let say a txt file look like this

    -----------------------------
    hello world


    this is mdl
    -----------------------------

    and i want to make it like this with a batch file

    -----------------------------
    hello world
    this is mdl
    -----------------------------

    any help..???
    thanx
    and s0rry if f0und me like a n0ob, i m new t0 this kind 0f things, and als0 english is n0t my primary language hah....
    :eek:
     
  2. searchengine

    searchengine Guest

    #2 searchengine, Jan 12, 2014
    Last edited by a moderator: Apr 20, 2017
    A.txt = txt with empty lines
    B.txt = save new txt without empty lines

    cmd
    Code:
    @echo off
    
    type A.txt | findstr /V "^$" > B.txt
    
    exit
     
  3. NaJeEb303

    NaJeEb303 MDL Novice

    Jul 26, 2013
    4
    0
    0
    #3 NaJeEb303, Jan 12, 2014
    Last edited by a moderator: Apr 20, 2017
    (OP)
    Thank you, but i dnt want to create a sec0nd file, i want a script that will make changes to the actual file and save that change in that exactly that file... thnx
     
  4. Imp Eached

    Imp Eached MDL Novice

    May 30, 2013
    5
    1
    0
    All you need to do is add the following two lines before exit

    erase A.txt
    rename B.txt A.txt