Sponsored Content
Top Forums Shell Programming and Scripting flexible sed command needed to handle multiple input types Post 302176951 by SiftinDotCom on Wednesday 19th of March 2008 04:39:13 PM
Old 03-19-2008
Thanks a lot for your input and code. As I see following two inputs

Input pattern is
^.*struct $1 { multi-line structure } $2;

Output is
ABC_DataDesc_T $1/$2_desc { multi-line structure };

where
1. only one out of $1 and $2 is non-empty
2. Anything before string "struct" (including struct) is replaced by a static string ABC_DataDesc_T (sorry about the confusing name, which made it look that it depends on name of struct)
3. everything between multi-line matching braces { } need to remain intact.
4. ; at the end

I will see if I can figure out lex/yacc
 

9 More Discussions You Might Find Interesting

1. Linux

File types help needed

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

help needed for sed command

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

Help needed in processing multiple variables in a single sed command.

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

SED command ---------help needed

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

Help needed on sed command

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

Help needed sed command.

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

sed command help needed.

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

Simplified find command to find multiple file types

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

SED command using multiple input files

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
BUF_RING(9)						   BSD Kernel Developer's Manual					       BUF_RING(9)

NAME
buf_ring, buf_ring_alloc, buf_ring_free, buf_ring_enqueue, buf_ring_dequeue_mc, buf_ring_dequeue_sc, buf_ring_count, buf_ring_empty, buf_ring_full, buf_ring_peek, -- multi-producer, {single, multi}-consumer lock-less ring buffer SYNOPSIS
#include <sys/param.h> #include <sys/buf_ring.h> struct buf_ring * buf_ring_alloc(int count, struct malloc_type *type, int flags, struct mtx *sc_lock); void buf_ring_free(struct buf_ring *br, struct malloc_type *type); int buf_ring_enqueue(struct buf_ring *br, void *buf); void * buf_ring_dequeue_mc(struct buf_ring *br); void * buf_ring_dequeue_sc(struct buf_ring *br); int buf_ring_count(struct buf_ring *br); int buf_ring_empty(struct buf_ring *br); int buf_ring_full(struct buf_ring *br); void * buf_ring_peek(struct buf_ring *br); DESCRIPTION
The buf_ring functions provide a lock-less multi-producer and lock-less multi-consumer as well as single-consumer ring buffer. The buf_ring_alloc() function is used to allocate a buf_ring ring buffer with count slots using malloc_type type and memory flags flags. The single consumer interface is protected by sc_lock. The buf_ring_free() function is used to free a buf_ring. The user is responsible for freeing any enqueued items. The buf_ring_enqueue() function is used to enqueue a buffer to a buf_ring. The buf_ring_dequeue_mc() function is a multi-consumer safe way of dequeueing elements from a buf_ring. The buf_ring_dequeue_sc() function is a single-consumer interface to dequeue elements - requiring the user to serialize accesses with a lock. The buf_ring_count() function returns the number of elements in a buf_ring. The buf_ring_empty() function returns TRUE if the buf_ring is empty, FALSE otherwise. The buf_ring_full() function returns TRUE if no more items can be enqueued, FALSE otherwise. The buf_ring_peek() function returns a pointer to the last element in the buf_ring if the buf_ring is not empty, NULL otherwise. RETURN VALUES
The buf_ring_enqueue() function return ENOBUFS if there are no available slots in the buf_ring. HISTORY
These functions were introduced in FreeBSD 8.0. BSD
September 27, 2012 BSD
All times are GMT -4. The time now is 08:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy