From owner-freebsd-questions@FreeBSD.ORG Thu Jan 31 07:26:40 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 338A416A418 for ; Thu, 31 Jan 2008 07:26:40 +0000 (UTC) (envelope-from jonathan+freebsd-questions@hst.org.za) Received: from hermes.hst.org.za (onix.hst.org.za [209.203.2.133]) by mx1.freebsd.org (Postfix) with ESMTP id 5D13613C458 for ; Thu, 31 Jan 2008 07:26:38 +0000 (UTC) (envelope-from jonathan+freebsd-questions@hst.org.za) Received: from sysadmin.hst.org.za (sysadmin.int.dbn.hst.org.za [10.1.1.20]) (authenticated bits=0) by hermes.hst.org.za (8.13.8/8.13.8) with ESMTP id m0V7JpEg021144 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Thu, 31 Jan 2008 09:19:51 +0200 (SAST) (envelope-from jonathan+freebsd-questions@hst.org.za) From: Jonathan McKeown Organization: Health Systems Trust To: freebsd-questions@freebsd.org Date: Thu, 31 Jan 2008 09:34:38 +0200 User-Agent: KMail/1.7.2 References: <47A0CA04.7060100@calarts.edu> In-Reply-To: <47A0CA04.7060100@calarts.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200801310934.38885.jonathan+freebsd-questions@hst.org.za> X-Spam-Score: -4.346 () ALL_TRUSTED,AWL,BAYES_00 X-Scanned-By: MIMEDefang 2.61 on 209.203.2.133 Subject: Re: Password file migration help X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jan 2008 07:26:40 -0000 On Wednesday 30 January 2008 21:03, Sean Murphy wrote: > I have a FreeBSD 5.4 system and would like to migrate users in the > password file with UIDs 3000 through 5000 to a FreeBSD 6.3 system on a > running on a separate box. Is there a way to export just those users? I'd probably sort /etc/master.passwd and pipe through awk: sort -t ':' -k3,3n /etc/master.passwd | \ awk -F ':' '$3 ~ /^3[0-9][0-9][0-9]/, $3 ~ /^5/ { print }' This will sort /etc/master.passwd numerically on the third field, uid, and then give you all the lines starting with the first one where the uid is a 3 followed by at least three digits, up to and including the first one after that where the first digit of the uid is a 5. If you capture the output you should be able to merge it on the new host. Jonathan