I'm stumped on this. As part of bash script, I get given a text file called IDENTIFIERS.TXT that contains a list of directories like this:
a_SomeDirectory
b_AnotherOne
c_YetAnother
And so on.
What I want to do is to check the IDENTIFIERS.TXT list against the output of ls
or something for the local contents of ./ItsInHere/
to see which directories on the list exist locally in that path and which do not, as I need that output to build another list of directories that do not exist locally to a new text file called INDENTIFIERS_GET.TXT for the next part of the bash script.
For example:
If a_SomeDirectory
and b_AnotherOne
exists in ./ItsInHere/
but c_YetAnother
doesn't, I'd need c_YetAnother
to be written to INDENTIFIERS_GET.TXT and then so on to the next.
I can see this kind of operation may need some crazy piping or something, or perhaps there's even a special command for this... Some kind of mix of ls
and sort
? I don't know. Any help?
Many thanks!