How to ensure one blank line on top of ASCII files?
    Norberto Meijome 
    freebsd at meijome.net
       
    Mon Feb 13 03:43:02 PST 2006
    
    
  
Kristian Vaaf wrote:
> 
> Hello!
> 
> I need to make sure all my ASCII files start with one blank line.
> 
> I just need to know what command to use,
> I've written the rest of the script to do this for me:
> 
> -- 
> 
echo "" > MY_BLANK_LINE.txt
> for file in `find -s . -type f -not -name ".*"`; do
> 
>     if file -b "$file" | grep -q 'text'; then
> 
	mv $file $file.tmp
	cat MY_BLANK_LINE.txt $file.tmp >> $file
	rm -f $file.tmp	
>         echo "$file: Done"
> 
>     fi
> 
> done
rm -f MY_BLANK_LINE.txt
There possibly are far more elegant solutions...but that should work.
    
    
More information about the freebsd-questions
mailing list