Rename file to kanji -- Solaris


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Rename file to kanji -- Solaris
# 1  
Old 03-27-2013
Rename file to kanji -- Solaris

Hi,

My shell script calls a perl script to create an excel and the shell
script emails the excel. This excel file needs to be renamed
to some Kanji name.

I have a flat file that has the required file name in kanji and i extract it
within the shell script and try to rename the file, but the filename shows junk.

the flat file itself has proper data coz the excel gets some kanji from the same flat file and is displayed properly.

fname=`grep FILENAME ${abcd}/etc/flat.cfg`
fname=`echo "${fname}" | awk '{ print substr($0,13,100) }'`
echo ${fname} --> itself displays junk Smilie

please help.
# 2  
Old 03-28-2013
You have a kanji displaying terminal setup? Feed the output to od -bc (well, I am too much an octal guy, but something like that) to see what is coming out, compared to what is in the file.

(No Hiragana or Katakana?)

Is this UTF8, UNICODE, EUC, ja : Encodings of Japanese
# 3  
Old 04-05-2013
Rename file to kanji -- Solaris

may be utf8...though i am not sure, how do i find out...?

file -i file.txt
regular file

vi file.txt
\203\214\203|\201[\203g

less file.txt
<83><8C><83>|<81>[<83>g

file created using notepad++
New file > Encoding > Character Sets> Japanese
then copy paste kanji characters from email which i received...
# 4  
Old 04-05-2013
Usually the provider or 'file' or a japanese text viewer can tell you. If it is unicode based like utf8, or any of the other Japanese encoding systems, there are wiki to help decode what is in the file's od output or other binary tools. Since we are talking file rename, I would expect utf8 to be most probable. Even with wide characters, in file names, bytes are bytes. I would expect you have a file system that is utf8 friendly, like the late model windows file windows file system, which I am told is in unicode of some sort under the covers.

Maybe write a little script in notepad++ Japanese, exporting LC_ALL compatibly, and rename the file in there.

Just 8 bytes in the file; how many gliphs did you paste? Shift-JIS looks a good match for 4 glyphs:
http://en.wikipedia.org/wiki/Shift-JIS
http://www.rikai.com/library/kanjita...des.sjis.shtml
http://demo.icu-project.org/icu-bin/...p?conv=ibm-942 for 0x838C 837C 815B 8367 gives: レ ポ ー ト

It says 'Report'!

Now, the trick is to get them into the right set for file names.

Google translate uses their utf8 codes: http://translate.google.com/#ja/en/%...83%BC%E3%83%88

0xE383AC should be the 3 byte utf8 for the first character. http://en.wikipedia.org/wiki/UTF-8#Description

= 0x3000 + 0x00C0 + 0x002C = 30EC = same lower right hook. http://en.wikipedia.org/wiki/Kana

It is katakana, appropriate for talking to 外人 http://translate.google.com/#ja/en/%E5%A4%96%E4%BA%BA

Interestingly, the word Gaijin for foreigner is two kanji.
http://en.wiktionary.org/wiki/%E5%A4%96 out, outside, external, foreign
http://en.wiktionary.org/wiki/%E4%BA%BA person, people, humanity, someone else

I had though those phonemes Gaijin meant http://translate.google.com/#ja/en/%E6%82%AA%E9%AD%94

Japanese Ministry of Educations says literate is about 2K kanji ! Universal Han has 22K or something like.

Google and wiki are your friends!
http://translate.google.com/#ja/en/G...81%99%EF%BC%81

Last edited by DGPickett; 04-05-2013 at 04:13 PM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash to copy file 3 times and rename based on another file

In the below bash I am trying to copy the only text file (always only one) in /home/cmccabe/Desktop/list/QC/metrics.txt and rename each of the 3 text files according to /home/cmccabe/Desktop/test/list.txt using lines 3, 4 ,5. This format (that is list.txt) is always 5 lines. Thank you :). ... (12 Replies)
Discussion started by: cmccabe
12 Replies

2. Shell Programming and Scripting

Rename specific file extension in directory with match to another file in bash

I have a specific set (all ending with .bam) of downloaded files in a directory /home/cmccabe/Desktop/NGS/API/2-15-2016. What I am trying to do is use a match to $2 in name to rename the downloaded files. To make things a more involved the date of the folder is unique and in the header of name... (1 Reply)
Discussion started by: cmccabe
1 Replies

3. UNIX for Dummies Questions & Answers

awk - Rename output file, after processing, same as input file

I have one input file ABC.txt and one output DEF.txt. After the ABC is processed and created output, I want to rename ABC.txt to ABC.orig and DEF to ABC.txt. Currently when I am doing this, it does not process the input file as it cannot read and write to the same file. How can I achieve this? ... (12 Replies)
Discussion started by: High-T
12 Replies

4. UNIX for Dummies Questions & Answers

look for specific values in a file and rename file with value found

Hi, i have a file with some data ..look for some specific value in the file and if found that value rename the file with the value found in the file.. ex.. File.txt 1236 43715825601ANDERSSON, 1236 437158256031963040120060901200609010000000 1236 43715825604123 MCCL AVE UPPER 1236 ... (11 Replies)
Discussion started by: dssyadav
11 Replies

5. UNIX for Dummies Questions & Answers

How to paste Kanji Characters into a Unix File

Hi, I am unable to copy Kanji characters into a unix file. They look like special characters when pasted into the Unix file. My objective is to copy these characters into a unix file and be able to print it and see the Kanji characters. Any help would be greatly appreciated. I am trying this... (1 Reply)
Discussion started by: andrussw
1 Replies

6. Solaris

Solaris Filesystem - rename the partition

Hi all i got this filesystem Filesystem size used avail capacity Mounted on /dev/dsk/c0t600A0B80001F350A000033404A5D29D9d0s2 492G 64M 487G 1% /u10 How do i change the name for /dev/dsk/c0t600A0B80001F350A000033404A5D29D9d0s2 to the... (3 Replies)
Discussion started by: SmartAntz
3 Replies

7. Solaris

Solaris 10 ld.so.1 rename

Why should you never rename ld.so.1 on a Solaris server? if you were going to replace ld.so.1, how can you do it safely? Please reply me soon. Thanks, Alberto (2 Replies)
Discussion started by: alberto
2 Replies

8. UNIX for Dummies Questions & Answers

Help required for Kanji characters in UNIX

Hi, I have a flat file containing Japanese(Kanji) characters.When I open it in my desktop it still shows up in Kanji characters. However when I FTP the file to Unix server , the kanji characters are lost and they turn into Junk characters. Can anyone suggest ways in how I can retain the Kanji... (2 Replies)
Discussion started by: papiya
2 Replies

9. UNIX for Dummies Questions & Answers

Rename file based on first 3 characters of data in file

I'm looking to determine if I can use a grep command to read file and rename the file based on the first 3 characters of the data in the file. An example is: Read FileA If the first 3 positions of the data in the file are "ITP", then rename the file as FileA_ITP, else if the first 3... (3 Replies)
Discussion started by: jchappel
3 Replies

10. UNIX for Dummies Questions & Answers

Help with multiple file rename - change case of part of file name

Hi there, I hope someone can help me with this problem : I have a directory (/var/www/file/imgprofil) which contains about 10000 JPG files. They have a naming convention thus : prefix-date-key-suffix.jpg they all have the prefix p-20050608- then AAAA is a 4 letter code the suffix is... (7 Replies)
Discussion started by: steve7
7 Replies
Login or Register to Ask a Question