Sponsored Content
Top Forums Shell Programming and Scripting using sed command to delete a string spanning multiple lines Post 302128537 by radha.kalivar on Wednesday 25th of July 2007 09:16:09 AM
Old 07-25-2007
i forgot to mention, the input file can be

sssssssssss
firstline secondline pppppppppp
ssssssssss
or
sssssssssss
firstline
secondline pppppppppp
ssssssssss

ie firtsline secondline can be on the same line or on different lines, and we should only delete only if we can find both firstline and secondline continueously. otherwise it should be retained
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Delete multiple lines w/ sed

Hi all, I am trying to figure out the syntx to delete multiple lines w/ sed. I know the following syntax will delete lines 1 THROUGH 5 from filex: sed 1,5d filex But I wan to delete lines 1 AND 5 (keeping lines 2,3, and 4). Does anyone know how to do this in a single sed statement? ... (2 Replies)
Discussion started by: bookoo
2 Replies

2. UNIX for Dummies Questions & Answers

Delete multiple lines containting a variable string using SED.

Good morning, Novice scripter in Unix here, and I've run into and sed task I can't quite wrap my head around. I'm pulling my hair out fast enough as it is and thought I would go to the knowledge bank. I have a sorted file that I'm trying to trim down by deleting any line whose first few... (2 Replies)
Discussion started by: selkirk
2 Replies

3. Shell Programming and Scripting

using sed command to replace multiple lines

the file contains the follwoing lines /* * Copyright (C) 1995-1996 by XXX Corporation. This program * contains proprietary and confidential information. All rights reserved * except as may be permitted by prior written consent. * * $Id: xxx_err.h,v 1.10 2001/07/26 18:48:34 zzzz $ ... (1 Reply)
Discussion started by: radha.kalivar
1 Replies

4. Shell Programming and Scripting

Script to display record spanning over multiple lines

Following are the lines from /etc/sudoers.conf bob SPARC = (OP) ALL : SGI = (OP) ALL fred ALL = (DB) NOPASSWD: ALL ALL CDROM = NOPASSWD: /sbin/umount /CDROM,\ /sbin/mount -o nosuid\,nodev /dev/cd0a /CDROM Could you please help me with shell/perl script to display the records with... (2 Replies)
Discussion started by: Ujan
2 Replies

5. Shell Programming and Scripting

Delete a line between selected lines using sed or any other command

I want to delete a line between selected lines using sed: e.g. : Between "bus" to "pins", delete lines conaining "signal" word. Input : bus direction signal new signal old pins signal ok end Desired Output: bus direction pins signal end (4 Replies)
Discussion started by: nehashine
4 Replies

6. Shell Programming and Scripting

replace (sed?) a single line/string in file with multiple lines (string) from another file??

Can someone tell me how I can do this? e.g: Say file1.txt contains: today is monday the 22 of NOVEMBER 2010 and file2.txt contains: the 11th month of How do i replace the word NOVEMBER with (5 Replies)
Discussion started by: tuathan
5 Replies

7. Shell Programming and Scripting

Replacing pattern spanning multiple lines

Hi. I have input like this: <tr> <td class="logo1" rowspan="2"><a href="index.html"><img src="images/logo.png" /></a></td> <td class="pad1" rowspan="2">__</td> <td class="userBox"><img src="images/person.png"/> <a href="http://good.mybook.com/login.jsp">Sign In</a></td> <td... (5 Replies)
Discussion started by: zorrox
5 Replies

8. Shell Programming and Scripting

sed to conditionally delete multiple lines

Hello I'd like to remove any line in an output file that is preceded by one or more warning messages (each warning is on a separate line). Example : WARNING: Estimation of lower confidence limit of \rho failed; setting it to 0. 822 28447 ... (4 Replies)
Discussion started by: jossojjos
4 Replies

9. Shell Programming and Scripting

replace (sed?) a string in file with multiple lines (string) from variable

Can someone tell me how I can do this? e.g: a=$(echo -e wert trewt ertert ertert ertert erttert erterte rterter tertertert ert) How do i replace the STRING with $a? I try this: sed -i 's/STRING/'"$a"'/g' filename.ext but this don' t work (2 Replies)
Discussion started by: jforce
2 Replies

10. Shell Programming and Scripting

delete the line with a particular string in a file using sed command.

Hello, I want to delete all lines with given string in file1 and the string val is dynamic. Can this be done using sed command. Sample: vars="test twinning yellow" for i in $vars do grep $i file1 if then echo "Do Nothing" else sed `/$i/d` file1 fi done Using the above... (5 Replies)
Discussion started by: PrasadAruna
5 Replies
Glib::ParseXSDoc(3pm)					User Contributed Perl Documentation				     Glib::ParseXSDoc(3pm)

NAME
Glib::ParseXSDoc - Parse POD and XSub declarations from XS files. DESCRIPTION
This is the heart of an automatic API reference documentation system for XS-based Perl modules. FIXME more info here!! FIXME document recognized POD directives and the output data structures FUNCTIONS
xsdocparse (@filenames) Parse xs files for xsub signatures and pod. Writes to standard output a data structure suitable for eval'ing in another Perl script, describing all the stuff found. The output contains three variables: $xspods = ARRAYREF array of pods found in the verbatim C portion of the XS file, listed in the order found. These are assumed to pertain to the XS/C api, not the Perl api. Any "=for apidoc" paragraphs following an "=object" paragraphs in the verbatim sections are stripped (as are the "=object" paragraphs), and will appear instead in "$data->{$package}{pods}". $data = HASHREF big hash keyed by package name (as found in the MODULE line), containing under each key a hash with all the xsubs and pods in that package, in the order found. Packages are consolidated across multiple files. FYI, this creates a new parser and calls "parse_file" on it for each input filename; then calls "swizzle_pods" to ensure that any "=for apidoc name" pods are matched up with their target xsubs; and finally calls Data::Dumper to write the data to stdout. So, if you want to get finer control over how the output is created, or keep all the data in-process, now you know how. :-) METHODS
$Glib::ParseXSDoc::verbose If true, this causes the parser to be verbose. $parser = Glib::ParseXSDoc->new Create a new xsub parser. string = $parser->package Get the current package name. Falls back to the module name. Will be undef if the parser hasn't reached the first MODULE line. HASHREF = $parser->pkgdata The data hash corresponding to the current package, honoring the most recently encountered "=for object" directive. Ensures that it exists. Returns a reference to the member of the main data structure, so modifications are permanent and useful. $parser->parse_file (filename) Parse one xs file. Stores all the collected data in $parser's internal data structures. $parser->swizzle_pods Match "=for apidoc" pods to xsubs. $parser->preprocess_pods Honor the "__hide__" and "__function__" directives in "=for apidoc" lines. We look for the strings anywhere, but you'll typically have it at the end of the line, e.g.: =for apidoc symname __hide__ for detached blocks =for apidoc __hide__ for attached blocks =for apidoc symname __function__ for functions rather than methods =for apidoc __function__ for functions rather than methods bool = $parser->is_module_line ($line) Analyze $line to see if it contains an XS MODULE directive. If so, returns true after setting the $parser's module, package, and prefix accordingly. $pod = $parser->slurp_pod_paragraph ($firstline, $term_regex=/^=cuts*/) Slurp up POD lines from $filehandle from here to the next $term_regex or EOF. Since you probably already read a line to determine that we needed to start a pod, you can pass that first line to be included. $xsub = $parser->parse_xsub (@lines) $xsub = $parser->parse_xsub (@lines) Parse an xsub header, in the form of a list of lines, into a data structure describing the xsub. That includes pulling out the argument types, aliases, and code type. Without artificial intelligence, we cannot reliably determine anything about the types or number of parameters returned from xsubs with PPCODE bodies. OUTLIST parameters are pulled from the args list and put into an "outlist" key. IN_OUTLIST parameters are put into both. Data type names are not mangled at all. Note that the method can take either a list of lines or a reference to a list of lines. The flat list form is provided for compatibility; the reference form is preferred, to avoid duplicating a potentially large list of strings. $parser->clean_out_empty_pods Looks through the data member of the parser and removes any keys (and associated values) when no pod, enums, and xsubs exist for the package. AUTHOR
muppet <scott at asofyet dot org> COPYRIGHT AND LICENSE
Copyright (C) 2003, 2004 by muppet This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. perl v5.14.2 2012-01-06 Glib::ParseXSDoc(3pm)
All times are GMT -4. The time now is 09:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy