[Top][All Lists]

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

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

From: lina
Subject: Re: [Help-bash] how to translate one file
Date: Tue, 03 Jan 2012 00:38:59 +0800
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20111114 Icedove/3.1.16

On Monday 02,January,2012 11:46 PM, lina wrote:

I have one file like

a 1
b 2
c 3

and the last line of the file like :


I wish to translate it to
1 2 3

Here is the script I wrote, but choked by the crucial step of translation,


for f in dm_1.xpm ### Here I used for cause I have 10 *.xpm files, and they have different dictionary.

awk '{if(NF==7) print $1, $6}' $f | tr -d '"' | sed 's/[a-Z]/\$&\=/g'

tail -1 $f | tr -d '"'

#echo ${f%.*}


I attached the file below,

BTW, Thanks all for helping me in the past, for some questions I asked, I still need time to digest about your reply. If none immediate response, it did not mean I did not care about the questions I asked. It means I cared both my questions and your reply. Thanks again,

Best regards,

I finished one, working well... but might be a bit clumsy.


for f in *.xpm

awk '{if(NF==7) print $1, $6}' $f | tr -d '"' | sed 's/[a-Z]/s\/& \//g' | tr -d ' ' | sed 's/^.*$/&\/g/g' > dict.txt

tail -1 $f | tr -d '"' > lastline.txt

sed -f dict.txt lastline.txt > ${f%.*}.out


exit 0

If you would love to share your way of doing this, please feel free to do.
I wish to see some other ways of doing this.

Thanks and best regards,

reply via email to

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