awk and filenames with spaces.....

Chris Malton chrism at cjsoftuk.dyndns.org
Mon May 21 15:06:38 UTC 2007


Solved it with PHP in the end.

Simply just made a function that took the string, separator and where to 
start.

Why didn't I think of that first....?

Chris


David Koski wrote:
> 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
> 
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 2146 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20070521/29869ae6/attachment.bin>


More information about the ubuntu-users mailing list