From owner-freebsd-questions@FreeBSD.ORG Fri Jul 12 01:36:14 2013 Return-Path: Delivered-To: questions@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id E122D6CC for ; Fri, 12 Jul 2013 01:36:14 +0000 (UTC) (envelope-from colin@restecp.com) Received: from max.restecp.com (max.restecp.com [IPv6:2a01:4f8:d13:e00::2]) by mx1.freebsd.org (Postfix) with ESMTP id A06E81145 for ; Fri, 12 Jul 2013 01:36:14 +0000 (UTC) Received: from max.restecp.com (localhost [127.0.0.1]) by max.restecp.com (Postfix) with ESMTP id CFD3B2C909E; Fri, 12 Jul 2013 01:36:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=restecp.com; h=message-id :date:from:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; s=dkim; bh=uqVFypENgFMy D5IncvBcHih+kWk=; b=shwG1kdcJY3g3gMCLKH8rUh2mS4Mb0bUeTf/6TL9iQGA bsyfOWWRWqT4kD/17qzDAXel6pQ7RUInBAvN0HwETF3gqLgoEEEdi7qceJnghs1l GC+6LqltZ1gvxiVm1J9V4KO/NolqZqeYibBiWJEK8QU3QrMSHAQkFyE0fVfz38EM ck/wmy7P18VcwL57K0Aa0svBFP3vF8Vvz9gDFUWXV75iQ9qVvWf0ELEpNpP86gTZ CMbTnZ95clKpSwdMpjwv2qYIDLojwW1l0dPk561N008N5UeZaiAFeLza5DU2RIGi EiipBnt6Q97QksmZYnnpZH4K4Jfe40z3Bl2Bx0YRPA== DomainKey-Signature: a=rsa-sha1; c=nofws; d=restecp.com; h=message-id :date:from:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; q=dns; s=dkim; b=b5/g5W m5QWfsZX+x04n6DIY/xBVOW7E+bAj8f1CzV+EQnsULY1kwVJD+naE6eDBuI0ATXt oOexpCH0Dj1FTbjJvT6cy30ucioVH1txToLTAQv0uqANPvMPMmit8C1TTt4m1ECO yyR5jGtI38ZlDmIUJaV3Kph5AUeepo/Vu5NaRoRMiptAGE1i8du1AX+vJ7lG3pFV b/O5PM/tWLI48OgtFfHpIiVwSmcR2/GxrCe5AIcM5FQN0RVKGm/lwjCwucEUox+o iACNop7Uqz0UVsiW8D1JJHFZSp5389vxgJUH7VcsXFm6vxyob13IehDThipcMujP Dw8wJ8mT7zzvlqUA== Received: from [172.30.42.66] (c58-107-26-142.fitzg4.qld.optusnet.com.au [58.107.26.142]) by max.restecp.com (Postfix) with ESMTPSA id 470CD2C908E; Fri, 12 Jul 2013 01:35:34 +0000 (UTC) Message-ID: <51DF5D3C.9050007@restecp.com> Date: Fri, 12 Jul 2013 11:34:52 +1000 From: Colin House User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 To: Fbsd8 Subject: Re: jls usage References: <51DF59B1.4020107@a1poweruser.com> In-Reply-To: <51DF59B1.4020107@a1poweruser.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: questions@FreeBSD.org X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jul 2013 01:36:14 -0000 On 12/07/2013 11:19 AM, Fbsd8 wrote: > In a .sh script I'm trying to get the jid for a single jail using this code > > jid=`jls -j jailname | cut -f 1- | awk '{print $1}'` > > The first line output by jls is a title line which the cut command is > suppose to cut out so the first field on line 2 gets selected by the awk > command. This is not working as I want, I get the first field of the > title line. > > Is the cut command the correct command to us here? > > This is what the jls command shows > # /root >jls -j dir2 > JID IP Address Hostname Path > 15 10.0.10.24 dir2 /usr/jails/dir2 > > I am after the number 15 > > Thanks in advance > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "freebsd-questions-unsubscribe@freebsd.org" this might do the trick for you: jls -j jailname | tail -1 | awk '{print $1}'