Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 11-06-2010, 10:42 PM   #1
LQ Newbie
Registered: Jul 2006
Location: Australia
Distribution: Mac OSX 10.6, Ubuntu 10.10
Posts: 23

Rep: Reputation: 0
how to process utf8 text of filenames to cp/ln

Hi everyone,

I have a unicode utf8 file containing filenames. I wish to process them with very basic scripts but the unicode is an issue.

A script to create symlinks to all the filenames and put them in a dir

while read line
	echo "${line}"
	ln -sF "${line}" /other/references/
done < filelist.txt
filelist.txt looks like this:
/other/test1/myfile with spaces.txt
/other/test1/myfile with spaces (2).txt
Any special way to address the unicode filenames? The links do not come out right. I am using Mac OSX GNU bash 3.2.48.
Old 11-07-2010, 02:23 PM   #2
LQ Newbie
Registered: Jul 2006
Location: Australia
Distribution: Mac OSX 10.6, Ubuntu 10.10
Posts: 23

Original Poster
Rep: Reputation: 0
unfortunately I could not find a bash based solution. It seems the unicode files are linked correctly, whereas the normal one are not. I believe it may have something to do with the newline character because the last line of the file was always linked only when there was no extra newline.

I gave up and made a python script instead
import os
import sys

logfile = open(sys.argv[1], "r").readlines()
for line in logfile:
	os.system("ln -sF \""+filename+"\" /other/references/")
works wonderfully except for files with single quotes in their names ' '


bash, ln, scripts, unicode

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
about I/O text files, UTF8 and C badry Programming 9 11-28-2009 05:06 PM
how can i display utf8 format in text area mlibot Linux - Newbie 6 08-12-2009 08:33 AM
utf8 cyrillic text in console emacs tramni1980 Slackware 7 08-25-2008 12:07 PM
Converting filenames from iso8859-7 to UTF8. hellblade Linux - General 1 04-27-2004 09:58 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:19 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration