How to ensure one blank line on top of ASCII files?
vaaf at broadpark.no
Mon Feb 13 10:17:04 PST 2006
At 12:42 13.02.2006, Norberto Meijome wrote:
>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.
I think I will look out for a more elegant approach :)
If I fail to find one, I will use your suggestion.
Thanks though, it kinda taught me a thing or two about shell programming.
All the best,
More information about the freebsd-questions