On 18/01/2013 23:26, Fbsd8 wrote: > 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? cut or awk spring to mind. I'm sure there are more :) (23:31:48 <~>) 0 jhary@ostracod $ ls -lh Cisco-vpn-Profiles.zip | cut -f 5 -w 16k (23:32:15 <~>) 0 jhary@ostracod $ ls -lh Cisco-vpn-Profiles.zip | awk '{print $5}' 16k (23:32:25 <~>) 0 jhary@ostracod $ ls -lh Cisco-vpn-Profiles.zip -rw-r--r-- 1 jhary wheel 16k 11 Jul 2004 Cisco-vpn-Profiles.zip (23:32:32 <~>) 0 jhary@ostracod $
Vince > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "freebsd-questions-unsubscr...@freebsd.org" _______________________________________________ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"