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
SHTOOL-SUBST.TMP(1)					      GNU Portable Shell Tool					       SHTOOL-SUBST.TMP(1)

NAME
shtool-subst - GNU shtool sed(1) substitution operations SYNOPSIS
shtool subst [-v|--verbose] [-t|--trace] [-n|--nop] [-w|--warning] [-q|--quiet] [-s|--stealth] [-i|--interactive] [-b|--backup ext] [-e|--exec cmd] [-f|--file cmd-file] [file] [file ...] DESCRIPTION
This command applies one or more sed(1) substitution operations to stdin or any number of files. OPTIONS
The following command line options are available. -v, --verbose Display some processing information. -t, --trace Enable the output of the essential shell commands which are executed. -n, --nop No operation mode. Actual execution of the essential shell commands which would be executed is suppressed. -w, --warning Show warning on substitution operation resulting in no content change on every file. The default is to show a warning on substitution operations resulted in no content change on all files. -q, --quiet Suppress warning on substitution operation resulting in no content change. -s, --stealth Stealth operation. Preserve timestamp on file. -i, --interactive Enter interactive mode where the user has to approve each operation. -b, --backup ext Preserve backup of original file using file name extension ext. Default is to overwrite the original file. -e, --exec cmd Specify sed(1) command directly. -f, --file cmd-file Read sed(1) command from file. EXAMPLE
# shell script shtool subst -i -e 's;(c) ([0-9]*)-2000;(c) 1-2001;' *.[ch] # RPM spec-file %install shtool subst -v -n -e 's;^(prefix=).*;1 $RPM_BUILD_ROOT%{_prefix};g' -e 's;^(sysconfdir=).*;1 $RPM_BUILD_ROOT%{_prefix}/etc;g' `find . -name Makefile -print` make install HISTORY
The GNU shtool subst command was originally written by Ralf S. Engelschall <rse@engelschall.com> in 2001 for GNU shtool. It was prompted by the need to have a uniform and convenient patching frontend to sed(1) operations in the OpenPKG package specifications. SEE ALSO
shtool(1), sed(1). 18-Jul-2008 shtool 2.0.8 SHTOOL-SUBST.TMP(1)