awk and filenames with spaces.....

David Koski david at kosmosisland.com
Mon May 21 14:59:47 UTC 2007


I don't know about awk but this works although there is probably a better
way:

unzip -qql myzipfile.zip \
	| while read line; \
	do name=$(echo $line \
	| sed 's/^[^      ]*[     ]*[^    ]*[     ]*[^    ]*//'); \
	echo $name; done

David

On Monday 21 May 2007 02:19, Chris Malton wrote:
> Hi,
>
> I'm trying to use awk in combination with unzip -l to list all the
> filenames in a zip archive.  The problem comes when there's a apce in
> the filename, as unzip uses spaces as separators.  How can I get awk to
> print from a particular index onwards?  Something like printing all
> fields higher than index 4, for example.
>
> Any ideas how?
>
> Chris





More information about the ubuntu-users mailing list