LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-21-2019, 04:04 PM   #1
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: FreeBSD/Slackware-14.2+/ArcoLinux
Posts: 8,981

Rep: Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874
How to seek and destroy upside down characters? (in a script if need be)


how to get rid of upside down characters?

Ramones - ¡Adios Amigos! - 01 - I Don't Want to Grow Up.mp3

I haven't ever started anything yet, because i have no idea how to tell the system to look for upside down characters.

I just want to rip them out of there and rename the files on the go without the upside down characters.
 
Old 07-21-2019, 04:19 PM   #2
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.6
Posts: 3,449

Rep: Reputation: 1157Reputation: 1157Reputation: 1157Reputation: 1157Reputation: 1157Reputation: 1157Reputation: 1157Reputation: 1157Reputation: 1157
I'd start with the hex or decimal representation and/or figure out how to type them to use in sed or awk.

I'm looking...
 
1 members found this post helpful.
Old 07-21-2019, 04:33 PM   #3
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: FreeBSD/Slackware-14.2+/ArcoLinux
Posts: 8,981

Original Poster
Rep: Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874
thanks for the lead, I'll go seek that out...
copy/paste into the command line might work, too.

yep, pretty smart idea...
Code:
[userx@arcomeo ~]$ bob="Ramones - ¡Adios Amigos! - 01 - I Don't Want to Grow Up.mp3"
[userx@arcomeo ~]$ echo -e $bob | sed s'|¡||'
Ramones - Adios Amigos! - 01 - I Don't Want to Grow Up.mp3

################ remove both ############

[userx@arcomeo ¡Adios Amigos!]$ echo -e $bob | sed s'|¡||;s|!||'
Ramones - Adios Amigos - 01 - I Don't Want to Grow Up.mp3

######### DONE ################
[userx@arcomeo ¡Adios Amigos!]$ for i in ./*.mp3 ; do bob=$(echo "$i" | sed s'|¡||;s|!||') ; mv "$i" "$bob" ; done

Last edited by BW-userx; 07-21-2019 at 04:53 PM.
 
1 members found this post helpful.
Old 07-21-2019, 04:52 PM   #4
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.6
Posts: 3,449

Rep: Reputation: 1157Reputation: 1157Reputation: 1157Reputation: 1157Reputation: 1157Reputation: 1157Reputation: 1157Reputation: 1157Reputation: 1157
Haven't figured out how to type them yet...pretty easy in Windows, but need to change the keyboard in Linux, and that's not working for me.

Did find these
Code:
!
ASCII 173 
hex A1

?
ASCII 168
hex BF
...tho your copy/paste solution is probably the simplest...

EDIT
A learning: On my Cinnamon desktop, typing Alt+number in an application that uses tabs, switches to that number tab. Very confusing when you're trying things in a multi-tab Firefox window!

Last edited by scasey; 07-21-2019 at 04:56 PM.
 
2 members found this post helpful.
Old 07-21-2019, 04:55 PM   #5
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: FreeBSD/Slackware-14.2+/ArcoLinux
Posts: 8,981

Original Poster
Rep: Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874Reputation: 1874
Quote:
Originally Posted by scasey View Post
Haven't figured out how to type them yet...pretty easy in Windows, but need to change the keyboard in Linux, and that's not working for me.

Did find these
Code:
!
ASCII 173 
hex A1

?
ASCII 168
hex BF
...tho your copy/paste solution is probably the simplest...
yeah that would be a cool challenge, but I did the copy paste thing. I posted it all in the upper post above.
thanks!!!
 
Old 07-21-2019, 05:05 PM   #6
individual
Member
 
Registered: Jul 2018
Posts: 231

Rep: Reputation: 175Reputation: 175
You can also use tr to remove anything that isn't ASCII.
Code:
echo "Ramones - ¡Adios Amigos! - 01 - I Don't Want to Grow Up.mp3" | tr -cd '\000-\177'
Basic ASCII is in the range of 0 to 127, which is 177 in octal. Unfortunately tr doesn't work with hexadecimal ranges, which would be easier, in my opinion.
 
1 members found this post helpful.
Old 07-21-2019, 11:09 PM   #7
ehartman
Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 801

Rep: Reputation: 399Reputation: 399Reputation: 399Reputation: 399
Quote:
Originally Posted by individual View Post
Basic ASCII is in the range of 0 to 127, which is 177 in octal. Unfortunately tr doesn't work with hexadecimal ranges, which would be easier, in my opinion.
And watch out for utf-8, ucs-2 and other such multi-byte characters, although at least in utf-8 they're all above 127 (have the highest bit set).
But probably you'll have to change the range to \1-\177, 'cause \0 normally isn't a legal character in text.
 
1 members found this post helpful.
Old 07-22-2019, 02:24 AM   #8
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,715

Rep: Reputation: 3034Reputation: 3034Reputation: 3034Reputation: 3034Reputation: 3034Reputation: 3034Reputation: 3034Reputation: 3034Reputation: 3034Reputation: 3034Reputation: 3034
Probably not what you were looking for, but my 2 cents would be to make the files linux ready, ie remove extraneous characters that are not nix friendly:
Code:
echo "Ramones - ¡Adios Amigos! - 01 - I Don't Want to Grow Up.mp3" | sed -r 's/[^[:alnum:].]+/_/g'
 
1 members found this post helpful.
  


Reply


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
LXer: Librethreat Database Entries: How Proprietary Software Giants Seek to Destroy Free/Open Source Software LXer Syndicated Linux News 0 06-30-2019 11:05 PM
dead keys, setxkbmap and upside down exclamation marks! Komakino Linux - Software 2 08-03-2010 11:16 AM
[SOLVED] .avi file plays reversed and upside down BobNutfield Linux - Software 9 05-16-2010 06:38 AM
LXer: The Upside Down Of HTML On Unix and Linux: Backward LXer Syndicated Linux News 0 08-27-2008 01:20 PM
MPlayer videos upside down! GTBlackwell Linux - Software 4 10-09-2003 06:48 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:52 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration