1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to Remove Unncessary Space Between lines in Dreamweaver?

Discussion in 'PHP' started by nile1483, Dec 28, 2007.

  1. #1
    Dear Friends

    i download sours file from my server , i see there are lots of unnecessary space between lines, how can i remove it, if i do that manually it will take lots of time so if you have any idea tell me.


    example
    I want to do it like
     
    nile1483, Dec 28, 2007 IP
  2. dataman

    dataman Peon

    Messages:
    94
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Just change the $base and it will scan all directories inside the $base directory removing all BLANK lines from all files ending with the extension .php!



    <?
    
    $base = array ( 'f:/www/docs/files/' ); // change = f:/www/docs/files/
    
    while ( ! empty ( $base ) )
    {
    	$next = array_pop ( $base );
    	foreach ( glob ( $next . '*.php' ) AS $item )
    	{
    		if ( ! is_dir ( $item ) )
    		{
    			file_put_contents ( $item, preg_replace ( array ( "#^\s*\r?\n+#s", "#\s*\r?\n+$#s", "#\s*\r?\n+#s" ), array ( "", "", "\r\n" ), file_get_contents ( $item ) ) );
    		}
    		else
    		{
    			$base[] = $item . '/';
    		}
    	}
    }
    
    echo 'done, removing extra lines';
    
    ?>
    PHP:
     
    dataman, Dec 28, 2007 IP
  3. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #3
    Easier:

    1. Open the file
    2. Click CTRL + F
    3. Select "Current document" in "Find in" (You can also select the folder if you have multiple files)
    4. Search in "Source code"
    5. Tick "Use regular expression"
    6. Type "[\r\n]{2,}" (without quotes) in "Find"
    7. Type "\n" (without quotes) in "Replace"
    8. Press "Replace All"

    Done.
     
    nico_swd, Dec 28, 2007 IP
    !Unreal and kishore415 like this.
  4. nile1483

    nile1483 Active Member

    Messages:
    345
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    60
    #4
    Thanks a lots , its done



     
    nile1483, Dec 28, 2007 IP
  5. Locochris05

    Locochris05 Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Ive been looking for this all my life thanks!!
     
    Locochris05, Oct 28, 2010 IP
  6. kasun0777

    kasun0777 Well-Known Member

    Messages:
    355
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    138
    #6
    Thanks for sharing
     
    kasun0777, Oct 28, 2010 IP
  7. opensourcesolutions

    opensourcesolutions Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7

    Gr8 stuff. Thank you.
     
    opensourcesolutions, Dec 27, 2012 IP
  8. amit0535

    amit0535 Active Member

    Messages:
    45
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    50
    #8
    This is the best way..
     
    amit0535, Jan 5, 2013 IP
  9. mgrohan

    mgrohan Active Member

    Messages:
    671
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    58
    #9


    You Sir are a legend. Looking for a long time for a way to do this. Thanks!!!!!
     
    mgrohan, Feb 21, 2013 IP
  10. Nusaint

    Nusaint Well-Known Member

    Messages:
    597
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    110
    Digital Goods:
    1
    #10
    I can't get it to work. What editor do I open it with? I am on Mac.

    Thanks
     
    Nusaint, Mar 24, 2015 IP