Last active
May 15, 2016 15:23
-
-
Save fonylew/070d5b5be49321f8e6f00dfb04376b24 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LC_ALL=C fgrep -n -f exclude.csv fav_story_test.csv > linenum.txt | |
comm -23 notlinenumber.txt exclude.csv | |
#get first column | |
cut -d : -f 1 linenum.txt > linenumber.txt | |
cut -d : -f 2 linenum.txt > notlinenumber.txt | |
//slow | |
cat linenumber.txt | while read line; do head -n $line random_pred.txt | tail -1; done >> random_diff.txt | |
//fast | |
cat linenumber.txt | while read line; | |
do | |
sed "${line}q;d" random_pred.txt >> random.txt | |
done | |
paste -d ',' user.csv random.txt > random_exclude.csv | |
cat random_exclude.csv >>concat.csv | |
sort --field-separator=',' -n concat.csv > sorteduser_output.csv | |
#remove first column | |
cut -d , -f 2- sorteduser_output.csv > output.csv | |
zip -r output output.csv | |
for i in `seq 0 1088`; do gsutil cp gs://dekd/out/recommend$i/part-00000 - ; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment