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
GREP(1) 						      General Commands Manual							   GREP(1)

NAME
grep - search a file for lines containing a given pattern SYNOPSIS
grep [-elnsv] pattern [file] ... OPTIONS
-e -e pattern is the same as pattern -c Print a count of lines matched -i Ignore case -l Print file names, no lines -n Print line numbers -s Status only, no printed output -v Select lines that do not match EXAMPLES
grep mouse file # Find lines in file containing mouse grep [0-9] file # Print lines containing a digit DESCRIPTION
Grep searches one or more files (by default, stdin) and selects out all the lines that match the pattern. All the regular expressions accepted by ed and mined are allowed. In addition, + can be used instead of * to mean 1 or more occurrences, ? can be used to mean 0 or 1 occurrences, and | can be used between two regular expressions to mean either one of them. Parentheses can be used for grouping. If a match is found, exit status 0 is returned. If no match is found, exit status 1 is returned. If an error is detected, exit status 2 is returned. SEE ALSO
cgrep(1), fgrep(1), sed(1), awk(9). GREP(1)