From owner-freebsd-questions@FreeBSD.ORG Fri Jan 18 23:56:15 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 8293DD28 for ; Fri, 18 Jan 2013 23:56:15 +0000 (UTC) (envelope-from fbsd8@a1poweruser.com) Received: from mail-03.name-services.com (mail-03.name-services.com [69.64.155.195]) by mx1.freebsd.org (Postfix) with ESMTP id 6205EEA1 for ; Fri, 18 Jan 2013 23:56:14 +0000 (UTC) Received: from [10.0.10.3] ([173.88.197.103]) by mail-03.name-services.com with Microsoft SMTPSVC(6.0.3790.4675); Fri, 18 Jan 2013 15:56:16 -0800 Message-ID: <50F9E11F.8070305@a1poweruser.com> Date: Fri, 18 Jan 2013 18:56:15 -0500 From: Fbsd8 User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: reza Subject: Re: sh script code to get file size. References: <50F9DA3E.5050607@a1poweruser.com> <1050558211.3259.1358552365235.JavaMail.root@lethalnetworks.com> In-Reply-To: <1050558211.3259.1358552365235.JavaMail.root@lethalnetworks.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 18 Jan 2013 23:56:16.0172 (UTC) FILETIME=[67320EC0:01CDF5D7] X-Sender: fbsd8@a1poweruser.com X-Authenticated-Sender: fbsd8@a1poweruser.com X-EchoSenderHash: [fbsd8]-[a1poweruser*com] Cc: FreeBSD questions 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, 18 Jan 2013 23:56:15 -0000 >> >> In a script in am working on I need to find out the allocated >> size of a sparse file. >> The only command that comes to mind is "ls -lh" >> The "du -h" command is not appropriate because it will show >> the occupied size and not the allocated size. >> >> I don't know how to parse out to the position in the output of that >> "ls -lh" command to pickup the file size value. >> >> Is there some other way to do this? >> >> reza wrote: > Does this work for you > > $ ls -lh | awk '{print $5}' > > 132B > 0B > 3.8k > 512B > 3.9k > 512B > 512B > 14M > 512B > > Thanks that works for me.