[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:1.9.2.24) Gecko/20111114 Icedove/3.1.16 |
On Monday 02,January,2012 11:46 PM, lina wrote:
Hi,
I have one file like
a 1
b 2
c 3
and the last line of the file like :
abc
I wish to translate it to
1 2 3
Here is the script I wrote, but choked by the crucial step of
translation,
#!/bin/sh
for f in dm_1.xpm ### Here I used for cause I have 10 *.xpm files, and
they have different dictionary.
do
awk '{if(NF==7) print $1, $6}' $f | tr -d '"' | sed 's/[a-Z]/\$&\=/g'
tail -1 $f | tr -d '"'
#echo ${f%.*}
done
I attached the file below,
https://docs.google.com/open?id=0B93SVRfpVVg3ZmFkOTNmYWEtNjJlNC00ZjhjLTlmODAtMDQ5ZmIzY2M1Y2I1
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.
#!/bin/sh
for f in *.xpm
do
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
done
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,
- [Help-bash] how to translate one file, lina, 2012/01/02
- Re: [Help-bash] how to translate one file,
lina <=
- Re: [Help-bash] how to translate one file, Greg Wooledge, 2012/01/03
- Re: [Help-bash] how to translate one file, Eric Blake, 2012/01/03
- Re: [Help-bash] how to translate one file, Greg Wooledge, 2012/01/03
- Re: [Help-bash] how to translate one file, lina, 2012/01/03
- Re: [Help-bash] how to translate one file, Eric Blake, 2012/01/03
Re: [Help-bash] how to translate one file, lina, 2012/01/04