Sponsored Content
Top Forums Shell Programming and Scripting Multiple line match using sed Post 302179773 by SiftinDotCom on Friday 28th of March 2008 01:04:23 PM
Old 03-28-2008
perl -0777 -pe 's/struct(\s*\{.*?\})\s*(\S*);/struct \2\1;/sg' $file worked only for strtuct leaving enum intact
 

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
MANDOC_HEADERS(3)					   BSD Library Functions Manual 					 MANDOC_HEADERS(3)

NAME
mandoc_headers -- ordering of mandoc include files DESCRIPTION
To support a cleaner coding style, the mandoc header files do not contain any include directives and do not guard against multiple inclusion. The application developer has to make sure that the headers are included in a proper order, and that no header is included more than once. The headers and functions form three major groups: Parser interface, Parser internals, and Formatter interface. Various rules are given below prohibiting the inclusion of certain combinations of headers into the same file. The intention is to keep the following functional components separate from each other: - mdoc(7) parser - man(7) parser - roff(7) parser - tbl(7) parser - eqn(7) parser - terminal formatters - HTML formatters - search tools Note that mere usage of an opaque type does not require inclusion of the header where that type is defined. Parser interface Each of the following headers can be included without including any other mandoc header. These headers should be included before any other mandoc headers. Afterwards, any other mandoc headers can be included as needed. "mandoc_aux.h" Requires <sys/types.h> for size_t. Provides the utility functions documented in mandoc_malloc(3). "mandoc.h" Requires <sys/types.h> for size_t. Provides enum mandoc_esc, enum mandocerr, enum mandoclevel, enum tbl_cellt, enum tbl_datt, enum tbl_spant, enum eqn_boxt, enum eqn_fontt, enum eqn_pilet, enum eqn_post, struct tbl_opts, struct tbl_head, struct tbl_cell, struct tbl_row, struct tbl_dat, struct tbl_span, struct eqn_box, struct eqn, the function prototype typedef mandocmsg(), the function mandoc_escape(3), the functions described in mchars_alloc(3), and the functions mparse_*() described in mandoc(3). Uses the opaque types struct mparse from read.c and struct mchars from chars.c for function prototypes. Uses the types struct mdoc from libmdoc.h and struct man from libman.h as opaque types for function prototypes. "mdoc.h" Requires <sys/types.h> for size_t. Provides enum mdoct, enum mdocargt, enum mdoc_type, enum mdoc_sec, enum mdoc_endbody, enum mdoc_disp, enum mdoc_list, enum mdoc_auth, enum mdoc_font, struct mdoc_meta, struct mdoc_argv, struct mdoc_arg, struct mdoc_bd, struct mdoc_bl, struct mdoc_an, struct mdoc_bf, struct mdoc_rs, struct mdoc_node, and the functions mdoc_*() described in mandoc(3). Uses the type struct mdoc from libmdoc.h as an opaque type for function prototypes. Uses pointers to the types struct tbl_span and struct eqn as opaque struct members. When this header is included, the same file should not include libman.h or libroff.h. "man.h" Provides enum mant, enum man_type, struct man_meta, struct man_node, and the functions man_*() described in mandoc(3). Uses the opaque type struct mparse from read.c for function prototypes. Uses the type struct man from libman.h as an opaque type for function prototypes. Uses pointers to the types struct tbl_span and struct eqn as opaque struct members. When this header is included, the same file should not include libmdoc.h or libroff.h. Parser internals The following headers require inclusion of a parser interface header before they can be included. All parser interface headers should pre- cede all parser internal headers. When any parser internal headers are included, the same file should not include any formatter headers. "libmandoc.h" Requires <sys/types.h> for size_t. Provides enum rofferr, struct buf, utility functions needed by multiple parsers, and the top-level functions to call the parsers. Uses the opaque types struct mparse from read.c and struct roff from roff.c for function prototypes. Uses the types enum mandocerr, struct tbl_span, and struct eqn from mandoc.h, struct mdoc from libmdoc.h, and struct man from libman.h as opaque types for function prototypes. "libmdoc.h" Requires "mdoc.h" for enum mdoct, enum mdoc_*, and struct mdoc_*. Provides enum mdoc_next, enum margserr, enum mdelim, struct mdoc, struct mdoc_macro, and many functions internal to the mdoc(7) parser. Uses the opaque types struct mparse from read.c and struct roff from roff.c. When this header is included, the same file should not include man.h, libman.h, or libroff.h. "libman.h" Requires "man.h" for enum mant and struct man_node. Provides enum man_next, struct man, struct man_macro, and many functions internal to the man(7) parser. Uses the opaque types struct mparse from read.c and struct roff from roff.c. When this header is included, the same file should not include mdoc.h, libmdoc.h, or libroff.h. "libroff.h" Requires <sys/types.h> for size_t, "mandoc.h" for struct tbl_* and struct eqn, and "libmandoc.h" for enum rofferr. Provides enum tbl_part, struct tbl_node, struct eqn_def, struct eqn_node, and many functions internal to the tbl(7) and eqn(7) parsers. Uses the opaque type struct mparse from read.c. When this header is included, the same file should not include man.h, mdoc.h, libman.h, or libmdoc.h. Formatter interface These headers should be included after any parser interface headers. No parser internal headers should be included by the same file. "out.h" Requires <sys/types.h> for size_t. Provides enum roffscale, struct roffcol, struct roffsu, struct rofftbl, a2roffsu(), and tblcalc(). Uses struct tbl_span from mandoc.h as an opaque type for function prototypes. When this header is included, the same file should not include manpath.h or mansearch.h. "term.h" Requires <sys/types.h> for size_t and "out.h" for struct roffsu and struct rofftbl. Provides enum termenc, enum termfont, enum termtype, struct termp_tbl, struct termp, and many terminal formatting functions. Uses the opaque types struct mchars from chars.c and struct termp_ps from term_ps.c. Uses struct tbl_span and struct eqn from mandoc.h as opaque types for function prototypes. When this header is included, the same file should not include html.h, manpath.h or mansearch.h. "html.h" Requires <sys/types.h> for size_t, <stdio.h> for BUFSIZ, and "out.h" for struct roffsu and struct rofftbl. Provides enum htmltag, enum htmlattr, enum htmlfont, struct tag, struct tagq, struct htmlpair, struct html, and many HTML formatting functions. Uses the opaque type struct mchars from chars.c. When this header is included, the same file should not include term.h, manpath.h or mansearch.h. "main.h" Provides the top level steering functions for all formatters. Uses the opaque type struct mchars from chars.c. Uses the types struct mdoc from libmdoc.h and struct man from libman.h as opaque types for function prototypes. "manpath.h" Requires <sys/types.h> for size_t. Provides struct manpaths and the functions manpath_manconf(), manpath_parse(), and manpath_free(). When this header is included, the same file should not include out.h, term.h, or html.h. "mansearch.h" Requires <sys/types.h> for size_t and <stdint.h> for uint64_t. Provides enum argmode, struct manpage, struct mansearch, and the functions mansearch_setup(), mansearch(), and mansearch_free(). Uses struct manpaths from manpath.h as an opaque type for function prototypes. When this header is included, the same file should not include out.h, term.h, or html.h. BSD
December 1, 2014 BSD
All times are GMT -4. The time now is 12:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy