Mailinglist Archive: opensuse (3644 mails)

< Previous Next >
Re: [SLE] Question for you all....
  • From: Tara L Andrews <tla@xxxxxxx>
  • Date: Mon, 25 Mar 2002 12:21:57 -0500
  • Message-id: <20020325122157.A6860@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
On Mon, Mar 25, 2002 at 11:19:24AM -0500, Keith Winston wrote:
On Mon, Mar 25, 2002 at 10:47:30AM -0500, Michael Garabedian wrote:
....I have two password files that I want to merge is there a command
that will do it.

I have looked at diff, but I want to merge existing files to a new one.

Do you mean two /etc/passwd files? If so, you could do something like
this:

cat passwd1 passwd2 | sort -u > merged_passwd

If you want to be fancy, you could use:

cat passwd1 passwd2 | sort -u -n -t: +2 > merged_passwd

which orders the entries by uid.

You want to make sure that you don't have two of the same userid in
the merged file; sort won't catch that unless the entire line is
identical.

-tara
< Previous Next >
Follow Ups