Given: large file with list of files and folder which contain a great number of files.
Need: remove from list files which exist in a folder.
Tools: Bourne Shell or Windows command line or Python.
>>9 OKAY YOU FUQIN ANGERED AN EXPERT PROGRAMMER
GODFUCKIGNDAMN
FIRST OF ALL, YOU DONT FUQIN KNOW WHAT A MAN PAGE IS
SECONDLY, THIS IS /prog/ DO NOT DEMAND USEFUL ANSWERS THE WAY YOU WANT THEM TO BE
THIRDLY PROGRAMMING IS ALL ABOUT PHILOSOPHY AND ``ABSTRACT BULLSHITE'' THAT YOU WILL NEVER COMPREHEND
AND FUQIN LASTLY, FUCK OFF WITH YOUR BULLSHYT
EVERYTHING HAS ALREADY BEEN ANSWERED IN >>4,8
Name:
Anonymous2009-05-06 7:47
>>10
1.I already read the goddamn man page twenty minutes ago, for god's sake! I have no idea what to do WITH it, not WHAT it does!
2./r/ is for porn, /g/ is for Linux vs Windows, where else to ask such question?
3.Sadly, I comprehend.
4.Thanks for trolling.
>>12
Can you tell me WHAT to do, not WITH what I should do it?
Name:
Anonymous2009-05-06 7:53
/prog/ is for hardcore haxx0rs only.
Name:
Anonymous2009-05-06 7:57
>>13 ``Give a man a fish; you have fed him for today. Teach a man to fish; and you have fed him for a lifetime''
—Author unknown
Nope, sorry. I might direct you to 7chan's pr instead, they will actually help you and not be assholes.
Name:
Anonymous2009-05-06 8:02
Give a man a fish and he will be reliant on you forever.
Kick him in the head and he'll eventually either figure out how to do it himself or die as a leech on the arse of society.
-Author Anonymous
Name:
Anonymous2009-05-06 8:11
Is it so hard to give just a single idea and not throwing obscure hints?
I tried doing `grep -v -f list.txt /folder` but received grep: memory exhausted.
I tried cutting only relevant fields from list and `comm` it with the file which contain existing files - but I have no idea how to preserve other fields.
I tried using python, but can't find anything related to search except `if list[:-1] not in dir:`, which doesn't work the way I want.
Name:
Anonymous2009-05-06 8:27
This thread is /pr/ QUALITY
Name:
Anonymous2009-05-06 8:30
Look, I'll just give an example, and not post any more, because my head hurts.
[0209][chris@anux:~/Desktop] echo "-A1" > foo [020A][chris@anux:~/Desktop] ls -A1
dead_dogs
hax
lolol [020B][chris@anux:~/Desktop] xargs -a foo ls
dead_dogs
hax
lolol [020C][chris@anux:~/Desktop]
From the file you can pass the arguments as well as switches (or whatever you call the -r -l -A things). Now please just think and put rm somewhere in here.
>>29
It is you who obviously needs to go back. Not necessarily to /b/, but certainly out of here.
By the way, the first step to solving any problem is formulating a problem description in a way other people can understand. >>1 shows a good example how not to perform this step. Or maybe you just plain suck at grammar, I'm not sure.
>>31
Yeah, my grammar not just suck, it's terrible.
Oh, by the way. Thanks for the help, mad haxx0rs.
I've finally done this script. On Bourne Shell.
Without xargs (I still don't understand why you so persistently suggested it and how I could've used it) and without rm (it can't delete lines no matter how hard I looked in man).
I know, it sucks, because it's worked for 43 minutes to process file, but in result it DONE what I've needed.
Name:
Anonymous2009-05-06 11:19
rm (it can't delete lines no matter how hard I looked in man).
Oh my, you got trolled pretty hard there.
Name:
Anonymous2009-05-06 12:11
My curiosity prevail.
What xargs can be used here for?
>>22
It is executed in windows command shell (and with slight modification you can execute it in (ba)sh). You're not implying that all this rm xargs sed stuff you're using is part of bourne shell, are you?
Name:
Gigantic Faggot2009-05-06 15:38
Just because I don't feel like teaching you anything I will draw this out as far as I have too.
#Python ISO bullshit here
import os
from mutex import mutex
from threading import Thread
def f(g):
global nlm
if not os.path.exists(g):
nlm.lock(z, g)
nlm.unlock()
if __name__ == "__main__":
h = open(q, 'r')
for l in h.xreadlines():
p = Thread(None, f, None, (l))
d.append(p)
p.start()
for t in d:
t.join()
print "Done!"
print nl
f = open('nl.txt', 'w')
f.write(nl)
f.close()