help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] how to translate one file


From: Greg Wooledge
Subject: Re: [Help-bash] how to translate one file
Date: Wed, 4 Jan 2012 10:05:06 -0500
User-agent: Mutt/1.4.2.3i

On Wed, Jan 04, 2012 at 10:51:41PM +0800, lina wrote:
> >>"A  c #FFFFFF " /* "0" */,
> >>"B  c #F8F8F8 " /* "0.0385" */,

> the output to be:
> 0 ....   ...     0.0385
> numerical value, not #FFFFFF

In that case, it's the 6th field, and you need to strip the leading " and
the trailing ".

> >#!/usr/bin/env bash
> >declare -A dict
> >while read -r key _ value _; do

Change to:  while read -r key _ _ _ _ value _; do

> >   [[ $key = \"* ]] || break
> >   key=${key#\"}
> >   value=${value#\#}

Change to:  value=${value#\"} value=${value%\"}

See http://mywiki.wooledge.org/BashFAQ/100 or many other resources for
how parameter expansion is used.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]