LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-06-2005, 10:43 AM   #1
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,304

Rep: Reputation: 65
renaming file with escaped ascii, octal or anything


I've been trying to rename some files that are messed up, and many of them actually need to have non-normal and non-printing characters in the filename. say i'm trying to rename a file from bmunch.r01 to bmunch{ascii character for delete by number or whatever}.r01.
In msdos what i'm trying to do could be done by holding down the alt key while typing the ascii number of the character, then releasing. I've tried loads of stuff like \O127 or whatever and printf and and echo and different combinations of single and double quotes, but with no luck. I can get printf and echo to print a character by octal, but i can't get that into the middle of a mv or rename command as a character of the file's name.
 
Old 08-07-2005, 06:33 AM   #2
oneandoneis2
Senior Member
 
Registered: Nov 2003
Location: London, England
Distribution: Ubuntu
Posts: 1,460

Rep: Reputation: 48
Try putting a backslash in front of the character - this instructs the shell to interpret the character AS a character rather than a regular expression
 
Old 08-07-2005, 08:59 AM   #3
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,304

Original Poster
Rep: Reputation: 65
I need to insert ascii characters that aren't on the keyboard such as octal 177, which is asci 127, and i've been trying the simple things such as \O177, and i can get the characters to print to screen singularly, but not as part of a mv or rename command. in dos or windows you could say "move filename.txt, then hold down alt then 255 on the keypad, let up alt and this is a blank space, and hit enter, and you've renamed the file to a blank space character.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
python: converting a 3 character octal string into and ASCII char llama_meme Programming 1 07-06-2010 02:00 PM
Read in an Octal number from a text file using C++ pjordan Programming 2 11-18-2004 03:03 PM
renaming a file?? U-Toast Linux - Newbie 2 08-29-2004 01:07 AM
Bulk File Renaming nevereverend Linux - Newbie 11 07-03-2004 05:28 PM
renaming or converting a text file to a dat file... tangaz Linux - Software 1 10-24-2003 06:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:50 AM.

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