How to convert C source from 8bit chars to 16bit chars?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to convert C source from 8bit chars to 16bit chars?
# 1  
Old 09-26-2007
How to convert C source from 8bit chars to 16bit chars?

I was using the following bash command inside the emacs compile command to search C++ source code:

grep -inr --include='*.h' --include='*.cpp' '"' * | sed "/include/d" | sed "/_T/d" | sed '/^ *\/\//d' | sed '/extern/d'

Emacs will then position me in the correct file and at the correct line number so I can edit it appropriate.

I want to locate all the string literals in my source code of the form "xyz" and convert them to invoke a macro so they look like this: _T("xyz") where _T is a macro.

The problem with the above grep and sed commands is that it locates quotes inside the slash-star star-slash comments. How can I write a script that does not match inside /* and */?

Thanks,
siegfried
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Shell script to split data with a delimiter having chars and special chars

Hi Team, I have a file a1.txt with data as follows. dfjakjf...asdfkasj</EnableQuotedIDs><SQL><SelectStatement modified='1' type='string'><! The delimiter string: <SelectStatement modified='1' type='string'><! dlm="<SelectStatement modified='1' type='string'><! The above command is... (7 Replies)
Discussion started by: kmanivan82
7 Replies

2. UNIX for Dummies Questions & Answers

number of chars

I am curious why the below returns 4 instead of 3 wc -c <<<aaa Whereasa=aaa;echo ${#a} returns 3. How to get 3 using here -string operator in the above scenario Thanks (2 Replies)
Discussion started by: pandeesh
2 Replies

3. UNIX for Dummies Questions & Answers

Find all chars before .

Howdy, I need a command which will find all of the characters in a line before the first . I am using Korn Thank you (3 Replies)
Discussion started by: jgrosecl
3 Replies

4. Shell Programming and Scripting

To Generate control chars[^M, ^C etc]

Hi Experts, Please let me know, how to generate control characters in a file. I want to test my script which will check for any control characters in a file before loading the data into the PRD Database. Thanks in Advance, Sapy. (2 Replies)
Discussion started by: saps19
2 Replies

5. Shell Programming and Scripting

find 4 chars on 2nd line, 44 chars over

I know this should be simple, but I've been manning sed awk grep and find and am stupidly stumped :( I'm trying to use sed (or awk, find, etc) to find 4 characters on the second line of a file.txt 44-47 characters in. I can find lots of sed things for lines, but not characters. (4 Replies)
Discussion started by: unclecameron
4 Replies

6. UNIX for Dummies Questions & Answers

Euro Sign and some other chars

First of all hello, this is my first post here. :) I have a problem with displaying the euro sign and two other characters from the ISO8859-7 greek set (the drachma sign and the ipogegrameni) in the UNIX platform. Either when I type them normally or if i try to read a text file with some of... (2 Replies)
Discussion started by: pavlos87
2 Replies

7. UNIX for Dummies Questions & Answers

Using SED to get n chars after given value from file

Hello, my name is Marc, I'm a linux starter :) and I hope you specialists can help me solving this issue. I have a file containing a lot of data. Somewhere in this file, there's a string called "Faultdump", directly followed by 64 chars of HEX data. I need to get the HEX part. I accomplished... (12 Replies)
Discussion started by: Kally
12 Replies

8. Shell Programming and Scripting

cut last 4 chars

hi i wanted to cut last 4 chars from a text file Input A-B-C-V-15-0115 A-BL-CLE-T-VALUE-0125 M-T-L-G-0115 AT-PR-PE-CCT-0135 Output 0115 0125 0115 0135 I tried cut -f - -d "-" (thinking cut -f 5- -d"-" gives 5 ot end of line so only - should give last but floped) (5 Replies)
Discussion started by: pbsrinivas
5 Replies

9. Shell Programming and Scripting

treating special chars

Hi, I need some advise on treating non printable chars over ascii value 126 Case 1 : On some fields in the text , I need to retiain then 'as-is' and load to a database.I understand it also depends on database codepage. but i just wanna know how do i ensure it do not change while loading... (1 Reply)
Discussion started by: braindrain
1 Replies

10. Shell Programming and Scripting

replace chars,

:rolleyes: Hi, I want to replace the particular text in the middle of the line. Ex. In the line 40-50 wanted to replace the char as 'x' (7 Replies)
Discussion started by: Jairaj
7 Replies
Login or Register to Ask a Question
RBASH(1)						      General Commands Manual							  RBASH(1)

NAME
rbash - restricted bash, see bash(1) RESTRICTED SHELL
If bash is started with the name rbash, or the -r option is supplied at invocation, the shell becomes restricted. A restricted shell is used to set up an environment more controlled than the standard shell. It behaves identically to bash with the exception that the follow- ing are disallowed or not performed: o changing directories with cd o setting or unsetting the values of SHELL, PATH, ENV, or BASH_ENV o specifying command names containing / o specifying a file name containing a / as an argument to the . builtin command o specifying a filename containing a slash as an argument to the -p option to the hash builtin command o importing function definitions from the shell environment at startup o parsing the value of SHELLOPTS from the shell environment at startup o redirecting output using the >, >|, <>, >&, &>, and >> redirection operators o using the exec builtin command to replace the shell with another command o adding or deleting builtin commands with the -f and -d options to the enable builtin command o using the enable builtin command to enable disabled shell builtins o specifying the -p option to the command builtin command o turning off restricted mode with set +r or set +o restricted. These restrictions are enforced after any startup files are read. When a command that is found to be a shell script is executed, rbash turns off any restrictions in the shell spawned to execute the script. SEE ALSO
bash(1) GNU Bash-4.0 2004 Apr 20 RBASH(1)