Sponsored Content
Top Forums Shell Programming and Scripting Multiple line match using sed Post 302179756 by SiftinDotCom on Friday 28th of March 2008 12:04:46 PM
Old 03-28-2008
Good Morning ERA,
Your perl magic works fine. It needs a bit of tweaking in my actual test case
perl -0777 -pe 's/(\s*\{.*?\})\s*(\S*);/\2\1;/sg'

Also, irrespective of
struct A{
...
}B;
or enum A{
...
}B;
It moves B up. Could you please help me with making it work for specifically struct scenario. Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed - Replace Line which contains the Pattern match with a new line

I need to replace the line containing "STAGE_DB" with the line "STAGE_DB $DB # database that contains the table being loaded ($workingDB)" Here $DB is passed during the runtime. How can I do this? Thanks, Kousikan (2 Replies)
Discussion started by: kousikan
2 Replies

2. Shell Programming and Scripting

Concatenating multiple lines to one line if match pattern

Hi all, I've been working on a script which I have hit a road block now. I have written a script using sed to extract the below data and pumped into another file: Severity............: MAJORWARNING Summary: System temperature is out of normal range. Severity............: MAJORWARNING... (13 Replies)
Discussion started by: phixsius
13 Replies

3. Shell Programming and Scripting

Perl: Match a line with multiple search patterns

Hi I'm not very good with the serach patterns and I'd need a sample how to find a line that has multiple patterns. Say I want to find a line that has "abd", "123" and "QWERTY" and there can be any characters or numbers between the serach patterns, I have a file that has thousands of lines and... (10 Replies)
Discussion started by: Juha
10 Replies

4. Shell Programming and Scripting

sed: find match and delete the line above

I am searching a dhcpd.conf to find the hardware ethernet match, then once the match is found delete just the line above it. For example: testmachine.example { hardware ethernet 00:00:00:00:00:00; fixed address 192.168.1.100; next-server 192.168.1.101; filename "linux-install/pxelinux.0"; }... (3 Replies)
Discussion started by: cstovall
3 Replies

5. Shell Programming and Scripting

SED - adding blank line after each Range Match

the following range matching works great but i wish to add a blank line after each range result set... which i've tried and researched to no avail MY INPUT DATA: CURRENT CODE I'M USING: sed -n '/*$/,/;/p' $INPUT_FILE RESULTS I'M GETTING: RESULT I looking to... (5 Replies)
Discussion started by: danmauer
5 Replies

6. Shell Programming and Scripting

SED, match a line block

Hello, I want to do a simple substitution using sed but I can't find a solution. Basically, from a Apache conf file, I would like to remove everything included between the <VirtualHost> and </VirtualHost> e.g SSLMutex file:/var/run/ssl_mutex <VirtualHost _default_:443> # A lot of config that... (5 Replies)
Discussion started by: RobertFord
5 Replies

7. Shell Programming and Scripting

SED - Match a line from a File

Hi, I want to match a line which exists in a file. I have written a test script similar to below - The content of the file file.txt would be like this - /usr/bin/1234.xcf /usr/bin/3456.xcf /usr/bin/7897.xcf /usr/bin/2345.xcf out=`sed -n '\/usr\/bin\/7897.xcf/p' file.txt 2>&1`... (3 Replies)
Discussion started by: angshuman_ag
3 Replies

8. Shell Programming and Scripting

Match multiple patterns in a file and then print their respective next line

Dear all, I need to search multiple patterns and then I need to print their respective next lines. For an example, in the below table, I will look for 3 different patterns : 1) # ATC_Codes: 2) # Generic_Name: 3) # Drug_Target_1_Gene_Name: #BEGIN_DRUGCARD DB00001 # AHFS_Codes:... (3 Replies)
Discussion started by: AshwaniSharma09
3 Replies

9. Shell Programming and Scripting

I need to know how to replace a line after a pattern match with an empty line using SED

Hi How Are you? I am doing fine! I need to go now? I will see you tomorrow! Basically I need to replace the entire line containing "doing" with a blank line: I need to the following output: Hi How Are you? I need to go now? I will see you tomorrow! Thanks in advance.... (1 Reply)
Discussion started by: sags007_99
1 Replies

10. Shell Programming and Scripting

Multiple pattern match and print the output in a single line

I need to match two patterns in a log file and need to get the next line of the one of the pattern (out of two patterns) that is matched, finally need to print these three values in a single line. Sample Log: 2013/06/11 14:29:04 <0999> (725102) Processing batch 02_1231324 2013/06/11... (4 Replies)
Discussion started by: rpm120
4 Replies
libmapiadmin/libmapiadmin.h(3)					   libmapiadmin 				    libmapiadmin/libmapiadmin.h(3)

NAME
libmapiadmin/libmapiadmin.h - Structures for MAPI admin functions. SYNOPSIS
#include <sys/types.h> #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <unistd.h> #include <errno.h> #include <string.h> #include <stdint.h> #include <talloc.h> #include <ldb.h> #include <tevent.h> #include 'libmapi/libmapi.h' Data Structures struct mapiadmin_ctx MAPI admin function context. Functions struct mapiadmin_ctx * mapiadmin_init (struct mapi_session *) Create and initialise a mapiadmin_ctx structure. enum MAPISTATUS mapiadmin_release (struct mapiadmin_ctx *) Clean up a mapiadmin_ctx structure. enum MAPISTATUS mapiadmin_user_add (struct mapiadmin_ctx *) Add a user to Active Directory. enum MAPISTATUS mapiadmin_user_del (struct mapiadmin_ctx *) Delete a user from Active Directory. enum MAPISTATUS mapiadmin_user_extend (struct mapiadmin_ctx *) Extend user attributes to be Exchange user. Detailed Description Structures for MAPI admin functions. Function Documentation struct mapiadmin_ctx* mapiadmin_init (struct mapi_session *session) [read] Create and initialise a mapiadmin_ctx structure. You should use mapiadmin_release to clean up the mapiadmin_ctx structure when done. enum MAPISTATUS mapiadmin_release (struct mapiadmin_ctx *mapiadmin_ctx) Clean up a mapiadmin_ctx structure. The structure is assumed to have been allocated using mapiadmin_init() or equivalent code. Author Generated automatically by Doxygen for libmapiadmin from the source code. Version 1.0 Sat Jun 14 2014 libmapiadmin/libmapiadmin.h(3)
All times are GMT -4. The time now is 06:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy