Date: Mon, 13 Feb 2006 19:16:44 +0100 From: Kristian Vaaf <vaaf@broadpark.no> To: Norberto Meijome <freebsd@meijome.net> Cc: questions@freebsd.org Subject: Re: How to ensure one blank line on top of ASCII files? Message-ID: <7.0.1.0.2.20060213191304.0219b820@broadpark.no> In-Reply-To: <43F070BA.1000205@meijome.net> References: <7.0.1.0.2.20060213094752.021a8eb0@broadpark.no> <43F070BA.1000205@meijome.net>
next in thread | previous in thread | raw e-mail | index | archive | help
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, Fafa
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7.0.1.0.2.20060213191304.0219b820>