You are not logged in.

#1 2013-01-24 10:47:53

whoops
Member
Registered: 2009-03-19
Posts: 891

[solved] Read c++ unicode escape thingies in bash trough pipe?

Hi!

I have a c++ text file that contains lots of those things:

\u00..

Is there a program / command  I can pipe that trough to get the real / readable unicode characters for those escape sequences or whatever that is in my shell? So far the only working way I found was putting a

printf "$(.......)"

... around the whole text, but that's sort of... messy.

Last edited by whoops (2013-01-24 12:14:12)

Offline

#2 2013-01-24 11:56:57

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,450
Website

Re: [solved] Read c++ unicode escape thingies in bash trough pipe?

I see an X-Y problem coming (what are you REALLY trying to do).  But what the hell, I'll answer your actual question:

while read -r line; do echo -e "$line"; done < file.cpp

"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#3 2013-01-24 12:13:56

whoops
Member
Registered: 2009-03-19
Posts: 891

Re: [solved] Read c++ unicode escape thingies in bash trough pipe?

Thanks!

Just been trying to get rid of some of those escape thingies in a shell scripts that reads from some variable/string definition or text files that were originally meant to be read by a C++ program... without making the code too hard to read...

What I was looking for turned out to be this:

| xargs -0 printf

... no idea how I could miss that "-0" the first 10 times I tried with xargs and it didn't work -.-"

=> solved.

Last edited by whoops (2013-01-24 12:19:23)

Offline

Board footer

Powered by FluxBB