changeset 201:30d2fb656029

scrapping grep -vf
author edhoprima@gmail.com <edhoprima@gmail.com>
date Mon, 29 Jun 2009 15:40:28 +0000
parents 8efa600ebfdb
children 3dbb5a6678f9
files moefetch.sh
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/moefetch.sh	Mon Jun 29 15:29:08 2009 +0000
+++ b/moefetch.sh	Mon Jun 29 15:40:28 2009 +0000
@@ -158,7 +158,7 @@
 		fi
 	done
 	[ "$(Count_Files "${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}")" -eq 0 ] && ISNEW=1
-	for i in error ok list newlist; do
+	for i in error ok list newlist templist; do
 		touch "${TEMP_PREFIX}-${i}" || Fatal_Err "Error creating ${TEMP_PREFIX}-${i}. This shouldn't happen"
 	done
 	#
@@ -232,7 +232,12 @@
 		#ls "../${TARGET_DIR}" | grep -vf "${TARGET_DIR}-error" > "${TARGET_DIR}-ok"
 		#
 		find "${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}" | comm -1 -3 "${TEMP_PREFIX}-error" - | sed -e "${SED_GET_FILENAME}" > "${TEMP_PREFIX}-ok"
-		cat "${TEMP_PREFIX}-list" | grep -vf "${TEMP_PREFIX}-ok" > "${TEMP_PREFIX}-newlist"
+		cat "${TEMP_PREFIX}-list" > "${TEMP_PREFIX}-templist"
+		while read -r IS_OK; do
+			cat "${TEMP_PREFIX}-templist" | grep -v "${IS_OK}" > "${TEMP_PREFIX}-newlist"
+			cat "${TEMP_PREFIX}-newlist" > "${TEMP_PREFIX}-templist"
+		done < "${TEMP_PREFIX}-ok"
+		#cat "${TEMP_PREFIX}-list" | grep -vf "${TEMP_PREFIX}-ok" > "${TEMP_PREFIX}-newlist"
 		echo "$(echo $(wc -l < "${TEMP_PREFIX}-newlist")) file(s) to be downloaded"
 		
 	else