Re: grep from one file and write to another

2007-06-24 Thread Vahid Moghaddasi
On 6/24/07, Tom Phoenix <[EMAIL PROTECTED]> wrote: On 6/23/07, Vahid Moghaddasi <[EMAIL PROTECTED]> wrote: But maybe you need the actual password file. You got it, I have to read /etc/passwd file only. > I am not sure how much I can read into memory space without affecting > other programs

Re: grep from one file and write to another

2007-06-23 Thread John W. Krahn
Vahid Moghaddasi wrote: Hi all, Hello, I am trying to read a colon delimited text file (filter.in) then search for each field in another file (/etc/passwd) and if it is found then write that line in the third file (passwd.out). Here is what I have written so far but it is not given me the cor

Re: grep from one file and write to another

2007-06-23 Thread Tom Phoenix
On 6/23/07, Vahid Moghaddasi <[EMAIL PROTECTED]> wrote: For each field (user) in the filter.in file, I will have to find the user in passwd file, wouldn't I need to re-read the passwd file as much as there are fields in filter.in file? Probably not. For one solution, you might be able to use g

Re: grep from one file and write to another

2007-06-23 Thread Vahid Moghaddasi
On 6/23/07, Tom Phoenix <[EMAIL PROTECTED]> wrote: > use File::Copy; Are you actually using File::Copy? I didn't find any call to it in your posted code. Sorry, I left it in by mistake. This code is a small part of a very large program. > use strict; > use warnings; That's good > $|=1

Re: grep from one file and write to another

2007-06-23 Thread Tom Phoenix
On 6/23/07, Vahid Moghaddasi <[EMAIL PROTECTED]> wrote: I am trying to read a colon delimited text file (filter.in) then search for each field in another file (/etc/passwd) and if it is found then write that line in the third file (passwd.out). use File::Copy; Are you actually using File::C

grep from one file and write to another

2007-06-23 Thread Vahid Moghaddasi
Hi all, I am trying to read a colon delimited text file (filter.in) then search for each field in another file (/etc/passwd) and if it is found then write that line in the third file (passwd.out). Here is what I have written so far but it is not given me the correct result. Thanks for any help.