Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Eek, I wrote:

while read fn </tmp/tabs.auto.filelist.txt; do
    sed 's/   /    /g' < $fn > /tmp/notabfile
    mv /tmp/notabfile $fn
done

But that is wrong... it will read the first line from file line over and over again, it seems. The 
correct syntax  would be:

while read fn; do
    sed 's/     /    /g' < $fn > /tmp/notabfile
    mv /tmp/notabfile $fn
done </tmp/tabs.auto.filelist.txt

/me blushes.

I admit that having to have the redirection of input to the while loop at the end, after the 
"done", does make it harder to read, especially if the loop is long. In this case the loop is not 
long, but still... so yeah, using "cat" here to pipe the file into the while loop is clearer, even 
if it introduces an extra process and pipe.

--tml



Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.