03-19-2008
flexible sed command needed to handle multiple input types
Hello, I need a smart sed command that can take any of the following two as an input and give below mentioned output. As you can see, I am trying to convert some C code
INPUT:
struct abc_sample1 {
char myString[32];
UINT16 myValue1[10];
UINT64 myValue2;
};
typedef struct {
char myString[32];
UINT16 myValue1[10];
UINT64 myValue2;
} abc_sample1;
OUTPUT:
ABC_DataDesc_T abc_sample1_desc[] = {
char myString[32];
UINT16 myValue1[10];
UINT64 myValue2;
};
Thanks a bunch
9 More Discussions You Might Find Interesting
1. Linux
Hi all, quick question...
Im trying to configure Redhat 9 to dial out to my ISP AOL. I have found some software to do this but at present I can't get net access under Linux for the reason stated. I can however acces the net using my laptop running windows.
The question is:
I have downloaded... (3 Replies)
Discussion started by: brady9953
3 Replies
2. UNIX for Dummies Questions & Answers
Hi all,
I need some help with sed command. I'm trying to move all the files with a modified date within 12:00 - 13:00.
What i'm doing here is to do is
ls -lt | grep 'Jun 22 12:' > list.txt
to get all file names within that period.
However how do i strip off
-rw-r--r-- 1 enfoot adi... (2 Replies)
Discussion started by: manualvin
2 Replies
3. Shell Programming and Scripting
Is it possible to process multiple variables in a single sed command?
I have the following ksh with three variables and I want to search for all variables which start with "var" inside input.txt.
I tired "$var$" but it just prints out everyting in input.txt and does not work.
$ more test.ksh... (5 Replies)
Discussion started by: stevefox
5 Replies
4. Shell Programming and Scripting
Hi all
I am new babie to shell script, so please advise me n help me .
suppose i have a string "abacus sabre", i need to replace occurences 'ab' with 'cd' and i need to store this result into same string and i need to return this result from script to the calling function, where as the string... (4 Replies)
Discussion started by: veerapureddy
4 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I am splitting a file based on pattern using sed -f command as below:
sed_cmd2 is the Pattern filename which has the below mentioned pattern in it:
#n
/\(.*\) \(.*\) \(mith\).*/w smith
Input file has following data
1 John Smith Chicago
2 Mary Smith New York
3 Judy... (2 Replies)
Discussion started by: 12345
2 Replies
6. Shell Programming and Scripting
I want to execute below command using line number as a variable.
sed '5c\ disk = jskdjfdsk' vm.cfg
How do i substitute a variable in place of 5
for example
i tried substituting
sed '$variablec\ disk = jskdjfdsk' vm.cfg
and
sed '"$variable"c\ disk = jskdjfdsk' vm.cfg)
but they... (2 Replies)
Discussion started by: pinga123
2 Replies
7. Shell Programming and Scripting
vif =
I need to replace "00:16:3E:64:FB:D3" to a new mac address value from below mentioned file.
# cat vm.cfg
acpi = 1
apic = 1
builder = 'hvm'
device_model = '/usr/lib/xen/bin/qemu-dm'
disk =
kernel = '/usr/lib/xen/boot/hvmloader'
memory = '300'
name = 'vm_temp'
on_crash =... (1 Reply)
Discussion started by: pinga123
1 Replies
8. Linux
Hi,
I'm using the following command to find the multiple requierd file types and its working fine
find . -name "*.pl" -o -name "*.pm" -o -name "*.sql" -o -name "*.so" -o -name "*.sh" -o -name "*.java" -o -name "*.class" -o -name "*.jar" -o -name "*.gz" -o -name "*.Z" -type f
Though... (2 Replies)
Discussion started by: vickramshetty
2 Replies
9. Shell Programming and Scripting
What is the syntax to use multiple input files in a SED command. i.e. substitute a word with a phrase in every file in a directory.
for every file in /usr/include that has the word "date" in the file
grep -l '\<date\>' /usr/include/*.h
find each occurrence of the word "time" in the file &... (3 Replies)
Discussion started by: sheoguey
3 Replies
LEARN ABOUT XFREE86
xquerydevicestate
XQueryDeviceState(3X11) X FUNCTIONS XQueryDeviceState(3X11)
NAME
XQueryDeviceState - query the state of an extension input device.
SYNTAX
int XQueryDeviceState(Display *display, XDevice *device);
ARGUMENTS
display Specifies the connection to the X server.
device Specifies the device whose state is to be queried.
DESCRIPTION
The XQueryDeviceState request queries the state of an input device. The current state of keys and buttons (up or down), and valuators
(current value) on the device is reported by this request. Each key or button is represented by a bit in the XDeviceState structure that
is returned. Valuators on the device report 0 if they are reporting relative information, and the current value if they are reporting
absolute information.
XQueryDeviceState can generate a BadDevice error.
STRUCTURES
The XDeviceState structure contains:
typedef struct {
XID device_id;
int num_classes;
XInputClass *data;
} XDeviceState;
The XValuatorState structure contains:
typedef struct {
unsigned char class;
unsigned char length;
unsigned char num_valuators;
unsigned char mode;
int *valuators;
} XValuatorState;
The XKeyState structure contains:
typedef struct {
unsigned char class;
unsigned char length;
short num_keys;
char keys[32];
} XKeyState;
The XButtonState structure contains:
typedef struct {
unsigned char class;
unsigned char length;
short num_buttons;
char buttons[32];
} XButtonState;
DIAGNOSTICS
BadDevice An invalid device was specified. The specified device does not exist or has not been opened by this client via XOpenInputDe-
vice. This error may also occur if some other client has caused the specified device to become the X keyboard or X pointer
device via the XChangeKeyboardDevice or XChangePointerDevice requests.
SEE ALSO
Programming with Xlib
XFree86 Version 4.7.0 XQueryDeviceState(3X11)