The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Adding Multiple Lines to Multiple Files dayinthelife Shell Programming and Scripting 2 06-04-2008 11:50 AM
retrieved multiple lines on multiple places in a file dala Shell Programming and Scripting 8 03-14-2008 03:28 PM
using sed command to delete a string spanning multiple lines radha.kalivar Shell Programming and Scripting 9 07-25-2007 10:26 AM
How can I replace multiple lines from different files ranga27 Shell Programming and Scripting 2 02-07-2007 08:57 PM
How to run awk command having multiple lines nani_g Shell Programming and Scripting 0 06-09-2006 02:49 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-10-2007
radha.kalivar radha.kalivar is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 5
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 $
*/

in this \n can be any where inside copy right stmt.
This should be replace with the following lines
/*
* Copyright (C) 1995-2004 by YYY. All rights reserved.
* This program contains proprietary and confidential information.
*/

I tried using the following commands

past="Copyright\s.*XXX Corporation\.[:word]*consent.[\s]"


pres='* Copyright (c) 2004 by YYY. All rights reserved.\
* This program contains proprietary and confidential information.'

sed "s/$past/$pres/" $fileName > fileMod

but it is not matching with copyright stmt in the file. can somebody correct this
  #2 (permalink)  
Old 07-10-2007
srikanthus2002's Avatar
srikanthus2002 srikanthus2002 is offline
Registered User
  
 

Join Date: Sep 2006
Location: Can u guess...!
Posts: 160
sed "s/$past/$pres/" $fileName > fileMod

use single code '

Code:
sed "s/'$past'/'$pres'/" $fileName > fileMod
try this ...
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:09 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0