Hi,
I need to translate many lines of code from (e.g.):
unsigned char 19_GHz_V_Brightness_Temp0;
unsigned char 85_GHz_H_Brightness_Temp3;
printf("%c", 85_GHz_H_Brightness_Temp1[i]);
to:
unsigned char f19_GHz_V_Brightness_Temp0;
unsigned char f85_GHz_H_Brightness_Temp3;
printf("%c", f85_GHz_Brightness_Temp1[i]);
(GCC didn't like these variable names without a prepended character.) The
only constant substrings among all of those variable names are "_GHz_" and
"_Brightness_Temp". The variables names are all the same length, however.
You can see I must match the lines with something like /[0-9][0-9]_GHz/.
That's great, but how can I then force awk or sed to just prepend the
letter 'f' to the variable name while leaving verbatim the rest of the
line?
I can think of a very complicated way involving arrays, but I thought
there might be something quick 'n dirty I have not discovered. TIA,
Eric
|
|
0
|
|
|
|
Reply
|
Eric
|
10/2/2003 5:19:49 PM |
|
In article <pan.2003.10.02.17.19.49.50312@cook.rm-this-word.met.edu>,
Eric <eric@cook.rm-this-word.met.edu> wrote:
>Hi,
>
>I need to translate many lines of code from (e.g.):
> unsigned char 19_GHz_V_Brightness_Temp0;
> unsigned char 85_GHz_H_Brightness_Temp3;
> printf("%c", 85_GHz_H_Brightness_Temp1[i]);
>to:
> unsigned char f19_GHz_V_Brightness_Temp0;
> unsigned char f85_GHz_H_Brightness_Temp3;
> printf("%c", f85_GHz_Brightness_Temp1[i]);
>
>(GCC didn't like these variable names without a prepended character.) The
>only constant substrings among all of those variable names are "_GHz_" and
>"_Brightness_Temp". The variables names are all the same length, however.
>
>You can see I must match the lines with something like /[0-9][0-9]_GHz/.
>That's great, but how can I then force awk or sed to just prepend the
>letter 'f' to the variable name while leaving verbatim the rest of the
>line?
>
>I can think of a very complicated way involving arrays, but I thought
>there might be something quick 'n dirty I have not discovered. TIA,
>
>Eric
sed 's/[0-9][0-9]_GHz/f&/g'
Chuck Demas
--
Eat Healthy | _ _ | Nothing would be done at all,
Stay Fit | @ @ | If a man waited to do it so well,
Die Anyway | v | That no one could find fault with it.
demas@theworld.com | \___/ | http://world.std.com/~cpd
|
|
0
|
|
|
|
Reply
|
demas
|
10/2/2003 5:46:38 PM
|
|
|
1 Replies
116 Views
(page loaded in 0.104 seconds)
Similiar Articles: Data with "," and field sepeator is ",", How to handle this - comp ...... expression matching by replacing ambigious # characters ... historical' field ... proc report split character in ... in the middle of some text might be used as a field ... How to get a number with 2 decimal, whatever this number is ...... it the way you want, and save it in a text field. ... two zeros; if there is a point but only one character after ... Helping combing into an array(?) numbers and characters ... Relationship Question - comp.databases.filemakerJeff, You could add a calculation field to "Database 1 ... is: Column_3 (calculation, text result) = Middle ... the point size and actual > size for a given character and ... How best to detect duplicate values in a column? - comp.databases ...... the title where exact match is actually *used* will be after ... them) on the title field ... doesn't have that character on it. Actualy, for most Latin-1 characters ... VT420 Flyback Transformer Needed - comp.os.vms... burned a hole through my thumb from the middle of ... of a character and one dot space between characters a 132 character ... I've been trying to get back into the field ever ... [comp.publish.cdrom] CD-Recordable FAQ, Part 1/4 - comp.publish ...Archive-name: cdrom/cd-recordable/part1 Posting-Frequency: monthly Last-modified: 2008/10/09 Version: 2.71 Send corrections and updates to And... Could anyone give me the spice-mode.el - comp.emacsHi, All I am new to *NIX and I am thinking of writing spice code under Emacs. However, I have no idea of Emacs Lisp. Hence, I could not write a packa... Frequently-Asked Questions about sed, the stream editorTo append 2 blank lines after each line matching a regex: ... Then replace the 3-character field separator and ... we have 3 fields of 10, 25, and 9 characters per field ... Characters and Strings (MATLABĀ®)Characters, strings, cell arrays of strings, string comparison, search and replace, character/numeric conversion ... Setting Field Width and Precision ... 7/12/2012 11:36:26 PM
|