|
From: Friedrich L. <fl...@fl...> - 2004-02-01 16:32:29
|
Heiko Zuerker wrote on 01.02.2004 16:50 MET: > Friedrich Lobenstock wrote: > >> Bruce Smith wrote on 01.02.2004 03:23 MET: >> >>> The grep example is the cleanest bash code, but what about performance? >>> The upgrade-config script is already a little slow, and I'm more >>> concerned about speed than how it looks. >>> >>> (my guess is still grep, but I'd like hear other thoughts) >> >> I think you could try the following (filelist.txt becomes selectlist): >> >> # build candidate list (a list of all available files) >> ....... >> /tmp/candidates >> >> # calculate intersection of candidate list with select list >> TO_SELECT=$(sort /tmp/candidates selectlist | uniq -d) >> >> for SELECT in $TO_SELECT; do >> # cycle through all the files that should be selected per default >> ...set variables... >> done >> >> "uniq -d" gives you those lines of both files that are equal, >> so you will get exactly a list of file that exist in the current >> config which should be selected per default. > > > I blame it on the early time, but I'm confused now.... > > Anyhow, you also need to check the filedate, you can exclude all the > 1980 ones. This should further reduce possible errors. Ok, to clarify this, I thought this is clear but if you only add the files with date > 1980 to the /tmp/candidates files the result should be what you want. PS: I don't have to tell you that you should run mktemp to create a temporary file (see sample code in "man 1 mktemp") instead of using /tmp/candidates which was just used to be descriptive. -- MfG / Regards Friedrich Lobenstock ____________________________________________________________________ Friedrich Lobenstock Linux Services Lobenstock URL: http://www.lsl.at/ Email: fl...@fl... ____________________________________________________________________ |