0

I have two files containing users, but the lists differ. My goal is to take all the users in file1 and remove them from file2. What would be a simple method for completing this?

-moktod

3
Contributors
8
Replies
9
Views
12 Years
Discussion Span
Last Post by Comatose
0

I have no idea how you would do that in Shell Scripting. I could do it in Perl fairly easily... but I think that might be a little bit of a task in Shell.

0

I should be able to iterate through file1 and say if a match is found in file2, do some sed removal of that line, right? I suppose I would need the correct sed command.

-moktod

0

I have no idea how you would do that in Shell Scripting. I could do it in Perl fairly easily... but I think that might be a little bit of a task in Shell.

How would you accomplish this in perl?

-moktod

0

Well, This isn't the perl forum, so I probably shouldn't have posted that in here (my apologies). In Either language, though, I would read the first file, and compare it to each line of the second file. In perl, I'd read both into arrays, loop through and compare the arrays.

0

Attached Is How I would do this with a Perl Script. I'm working on doing it in bash shell right now also... but it seems a bit more complicated to me.... maybe I just like the feel of perl better, and so it flows more naturally and easy to me... but I'll keep giving it a go in Shell.

1

I have two files containing users, but the lists differ. My goal is to take all the users in file1 and remove them from file2. What would be a simple method for completing this?

-moktod

look into 'man comm'

Votes + Comments
Nice.
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.