The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
rename bohoo Shell Programming and Scripting 1 04-07-2008 12:05 PM
How to rename Xterm terminal in VNC session bache_gowda UNIX for Dummies Questions & Answers 0 04-16-2007 03:44 AM
Pseudo-terminal will not be allocated because stdin is not a terminal. Shivdatta UNIX for Advanced & Expert Users 0 03-20-2006 06:58 AM
rename using mv ? simon2000 UNIX for Dummies Questions & Answers 2 03-19-2004 12:46 AM
connecting to unix through hyper terminal - as a dumb terminal michelle UNIX for Advanced & Expert Users 2 11-05-2001 11:32 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-16-2008
Registered User
 

Join Date: Mar 2008
Location: /home/
Posts: 69
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
chm and pdf help in terminal (rename)

i have a cd of pdf and chm documents that i transfered from my windows xp box. i transfered the files to my linux box (ubuntu hardy). unfortunately, i used to be a windows GUI only user so the use of spaces and "( )" and underscores. now that i use linux, ive been using CLI for using and moving/coping files. when i tried to view a .chm file, i had installed chmsee for those files, i got problems saying that the use of "(" isnt allowed. is there anyway in the terminal to use those files in such a fashion like, for example, the file "Linux file (2005).chm", and use "mv" the change the name without having to use GUI. something like this:
"mv Linux file (2005).chm Linux_file_2005.chm"
is this possible???
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 05-17-2008
era era is online now
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 2,252
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
You just need to escape or double quote the special characters on the command line. In my experience, Bash does this for you automatically with tab completion, although there are some minor glitches.

The only characters you absolutely cannot use in a file name are slash (because it's used to separate directories) and ASCII null (because it's used internally to terminate strings).

Here's a quick attempt at batch rename.

Code:
for f in *; do
  case $f in *[!A-Za-z0-9_-]*)  mv -i "$f" "`echo "$f" | tr " " _ | tr -dc A-Za-z0-9_-`";; esac
done
This might be even a little bit too conservative in what characters it will accept in a file name, but at least it's a start.
Reply With Quote
  #3 (permalink)  
Old 05-17-2008
Registered User
 

Join Date: Mar 2008
Location: /home/
Posts: 69
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
ok
i used the double quotes around the original file name and then changed it with underscores. thanks for the tip.

Code:
for ex: linux books 2005.chm
$mv "linux books 2005.chm" linux_books_2005.chm
the only problems i have is that im trying to open the files up with ChmSee via terminal

Code:
chmsee linux_books_2005.chm
the problem is i get this
Code:
chmsee: error while loading shared libraries: libxul.so: cannot open shared object file: No such file or directory
should i get another viewer or is there a way to get the libxul.so file
Reply With Quote
  #4 (permalink)  
Old 05-17-2008
era era is online now
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 2,252
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
If you installed chmsee from an Ubuntu repository, it should have pulled in any packages it depends on.

Code:
vnix$ apt-file search libxul.so
libxul-dev: usr/lib/libxul.so
libxul0d: usr/lib/libxul.so.0d
libxul0d: usr/lib/xulrunner/libxul.so
libxul0d-dbg: usr/lib/debug/usr/lib/libxul.so.0d
xulrunner-1.9: usr/lib/xulrunner-1.9a8/libxul.so
xulrunner-1.9-dev: usr/lib/xulrunner-devel-1.9a8/sdk/lib/libxul.so
If you just want the library, I guess you should linstall libxul0d, although it's of course somewhat likely that the exact version is not what chmsee wants.

(XUL is the Mozilla toolkit, XULrunner is basically Mozilla without the actual browser -- can be useful for running Chatzilla as a separate process, for example.)
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes


The 50 most popular UNIX and Linux searches.
Google Search Cloud for The UNIX and Linux Forums
421 service not available, remote server has closed connection ^m automate ftp autosys awk trim bash eval bash for loop boot: cannot open kernel/sparcv9/unix command copy/move folder in unix couldn't set locale correctly curses.h cut command in unix export command in unix find grep find mtime find null character in a unix file grep multiple lines grep or grep recursive inaddr_any inappropriate ioctl for device lynx javascript mailx attachment mget mtime perl array length ping port remove first character from string in k shell replace space by comma , perl script rsync ftp scp recursive segmentation fault(coredump) sftp script snoop unix stale nfs file handle syn_sent tar exclude tar extract to folder test: argument expected unix unix .profile unix forum unix forums unix internals unix interview questions unix mtime unix simulator unix.com vi substitute while loop within while loop shell script


All times are GMT -7. The time now is 02:48 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101