Unix command to remove whitespace in the first few lines

Illiggelm

New Member
I'm using this unix command(in a php file) to remove a certain string and then remove the whitespace left by that string. Unfortunately in many cases, the files get completely erased. Is there a workaround? \[code\]<?php$dir = "./";$rmcode = `find $dir -name "*.php"-type f |xargs sed -i 'somestring' 2>&1`; echo "String removed.<br />\n";$emptyline = `find $dir -name "*.php"-type f | xargs sed -i '/./,$!d' 2>&1`; echo "Empty lines removed.<br/>\n";?>\[/code\]EditWould this work?\[code\]$emptyline = `find $dir -name "*.php"-type f | xargs sed -i '/./,$!d' 2>&1`; echo "Empty lines removed.<br/>\n";\[/code\]becomes \[code\]$emptyline = `find $dir -name "*.php"-type f | xargs sed -i '/\s/,$!d' 2>&1`; echo "Empty lines removed.<br/>\n";\[/code\]
 
Back
Top