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: Tue, 3 Jan 2012 10:23:29 -0500
User-agent: Mutt/1.4.2.3i

On Tue, Jan 03, 2012 at 11:15:20PM +0800, lina wrote:
> /* Generated by g_mmdat_g_f */
> /* legend:  "Distance (nm)" */
> /* x-label: "Residue Index" */
> /* y-label: "Residue Index" */
> static char *grmacos_xpm[] = {
> "D  c #EBEBEB " /* "0.115" */,
> "E  c #E5E5E5 " /* "0.154" */,
> "F  c #DEDEDE " /* "0.192" */,
> "G  c #D8D8D8 " /* "0.231" */,

And you can't use some existing XPM parsing program to do whatever it is
you're trying to do?

> I have problem in dropping the first 5 lines. I wish to start with the 
> parts include key and value.

If you know in advance that it's 5 lines, then:

while IFS='" ' read _ letter _ color _; do
  ...
done < <(sed 1,5d foobar.xpm)

Or if you want to be a bit less rigid, then:

while IFS='" ' read _ letter _ color _; do
  ...
done < <(grep '^"' foobar.xpm)

Though I'd still look for existing XPM tools.

P.S., http://mywiki.wooledge.org/BashFAQ/001



reply via email to

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