Sponsored Content
Top Forums Shell Programming and Scripting Sed/awk/perl command to replace pattern in multiple lines Post 302747219 by sathyaonnuix on Friday 21st of December 2012 12:18:07 AM
Old 12-21-2012
Have a look on this thread.

Code:
# nl file
     1  Sathya
     2  Sathya
     3  Sathya
     4  Sathya
     5  SAthya
     6  Narayanan
     7  Narayanan
     8  Sathya
     9  Sathya
    10  Narayanan

Code:
# sed -e "1s/Sathya/XXX/" -e "3s/Sathya/XXX/" -e "9s/Sathya/XXX/" file
XXX
Sathya
XXX
Sathya
SAthya
Narayanan
Narayanan
Sathya
XXX
Narayanan


Last edited by sathyaonnuix; 12-21-2012 at 01:23 AM..
 

10 More Discussions You Might Find Interesting

1. 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

2. Shell Programming and Scripting

Perl: Printing Multiple Lines after pattern match

Hello People, Need some assistance/guidance. OUTLINE: Two files (File1 and File2) File1 has some ids such as 009463_3922_1827 897654_8764_5432 File2 has things along the lines of: Query= 009463_3922_1827 length=252 (252 letters) More stufff here ... (5 Replies)
Discussion started by: Deep9000
5 Replies

3. Shell Programming and Scripting

sed/awk to insert multiple lines before pattern

I'm attempting to insert multiple lines before a line matching a given search pattern. These lines are generated in a separate function and can either be piped in as stdout or read from a temporary file. I've been able to insert the lines from a file after the pattern using: sed -i '/pattern/... (2 Replies)
Discussion started by: zksailor534
2 Replies

4. Shell Programming and Scripting

awk/sed/perl command to delete specific pattern and content above it...

Hi, Below is my input file: Data: 1 Length: 20 Got result. Data: 2 Length: 30 No result. Data: 3 Length: 20 (7 Replies)
Discussion started by: edge_diners
7 Replies

5. Shell Programming and Scripting

Command to remove duplicate lines with perl,sed,awk

Input: hello hello hello hello monkey donkey hello hello drink dance drink Output should be: hello hello monkey donkey drink dance (9 Replies)
Discussion started by: cola
9 Replies

6. Shell Programming and Scripting

Replace multiple lines through sed

Hi All, I have a input file as sample below <this is not starting of file> record line1 line2 line3 end line4 line5 record line6 line7 line8 my requirement is this, i want to select a pattern between first record and end, whatever is written between first record and end. and... (0 Replies)
Discussion started by: adgangwar
0 Replies

7. Shell Programming and Scripting

Sed replace using same pattern repeating multiple times in a line

Sed replace using same pattern repeating multiple times in a line I have text like below in a file: I am trying to replace the above line to following How can I acheive this? I am able to do it if the occurrence is for 1 time: But If I try like below I am getting like this: I have to... (4 Replies)
Discussion started by: sol_nov
4 Replies

8. Shell Programming and Scripting

Replacing lines matching a multi-line pattern (sed/perl/awk)

Dear Unix Forums, I am hoping you can help me with a pattern matching problem. What am I trying to do? I want to replace multiple lines of a text file (that match a multi-line pattern) with a single line of text. These patterns can span several lines and do not always have the same number of... (10 Replies)
Discussion started by: thefang
10 Replies

9. Shell Programming and Scripting

sed command to replace two character pattern with another pattern

Not able to paste my content. Please see the attachment :-( (2 Replies)
Discussion started by: vivek d r
2 Replies

10. Shell Programming and Scripting

Sed/awk/perl substitution with multiple lines

OSX I have been grinding my teeth on a portion of code. I am building a bash script that edits a html email template. In the template, I have place holders for SED (or whatever program is appropriate) to use as anchors for find and replace, with user defined corresponding html code. The HTML code... (3 Replies)
Discussion started by: sudo
3 Replies
DateTime::Locale::gez(3)				User Contributed Perl Documentation				  DateTime::Locale::gez(3)

NAME
DateTime::Locale::gez SYNOPSIS
use DateTime; my $dt = DateTime->now( locale => 'gez' ); print $dt->month_name(); DESCRIPTION
This is the DateTime locale package for Geez. DATA
This locale inherits from the DateTime::Locale::root locale. It contains the following data. Days Wide (format) XXX XXX XXX XXX XXX XXXX XXX Abbreviated (format) XXX XXX XXX XXX XXX XXX XXX Narrow (format) X X X X X X X Wide (stand-alone) XXX XXX XXX XXX XXX XXXX XXX Abbreviated (stand-alone) XXX XXX XXX XXX XXX XXX XXX Narrow (stand-alone) X X X X X X X Months Wide (format) XXX XXX XXX XXX XXXX XXX XXX XXX XXX XXX XXX XXX Abbreviated (format) XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX Narrow (format) X X X X X X X X X X X X Wide (stand-alone) XXX XXX XXX XXX XXXX XXX XXX XXX XXX XXX XXX XXX Abbreviated (stand-alone) XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX Narrow (stand-alone) X X X X X X X X X X X X Quarters Wide (format) Q1 Q2 Q3 Q4 Abbreviated (format) Q1 Q2 Q3 Q4 Narrow (format) 1 2 3 4 Wide (stand-alone) Q1 Q2 Q3 Q4 Abbreviated (stand-alone) Q1 Q2 Q3 Q4 Narrow (stand-alone) 1 2 3 4 Eras Wide BCE CE Abbreviated X/X X/X Narrow X/X X/X Date Formats Full 2008-02-05T18:30:30 = XXXX 05 XXX XXXX 2008 X/X 1995-12-22T09:05:02 = XXXX 22 XXX XXXX 1995 X/X -0010-09-15T04:44:23 = XXXXX 15 XXX XXXX -10 X/X Long 2008-02-05T18:30:30 = 05 XXX 2008 1995-12-22T09:05:02 = 22 XXX 1995 -0010-09-15T04:44:23 = 15 XXX -10 Medium 2008-02-05T18:30:30 = 05-XXX-2008 1995-12-22T09:05:02 = 22-XXX-1995 -0010-09-15T04:44:23 = 15-XXX--10 Short 2008-02-05T18:30:30 = 05/02/08 1995-12-22T09:05:02 = 22/12/95 -0010-09-15T04:44:23 = 15/09/-10 Default 2008-02-05T18:30:30 = 05-XXX-2008 1995-12-22T09:05:02 = 22-XXX-1995 -0010-09-15T04:44:23 = 15-XXX--10 Time Formats Full 2008-02-05T18:30:30 = 6:30:30 XXX UTC 1995-12-22T09:05:02 = 9:05:02 XXX UTC -0010-09-15T04:44:23 = 4:44:23 XXX UTC Long 2008-02-05T18:30:30 = 6:30:30 XXX UTC 1995-12-22T09:05:02 = 9:05:02 XXX UTC -0010-09-15T04:44:23 = 4:44:23 XXX UTC Medium 2008-02-05T18:30:30 = 6:30:30 XXX 1995-12-22T09:05:02 = 9:05:02 XXX -0010-09-15T04:44:23 = 4:44:23 XXX Short 2008-02-05T18:30:30 = 6:30 XXX 1995-12-22T09:05:02 = 9:05 XXX -0010-09-15T04:44:23 = 4:44 XXX Default 2008-02-05T18:30:30 = 6:30:30 XXX 1995-12-22T09:05:02 = 9:05:02 XXX -0010-09-15T04:44:23 = 4:44:23 XXX Datetime Formats Full 2008-02-05T18:30:30 = XXXX 05 XXX XXXX 2008 X/X 6:30:30 XXX UTC 1995-12-22T09:05:02 = XXXX 22 XXX XXXX 1995 X/X 9:05:02 XXX UTC -0010-09-15T04:44:23 = XXXXX 15 XXX XXXX -10 X/X 4:44:23 XXX UTC Long 2008-02-05T18:30:30 = 05 XXX 2008 6:30:30 XXX UTC 1995-12-22T09:05:02 = 22 XXX 1995 9:05:02 XXX UTC -0010-09-15T04:44:23 = 15 XXX -10 4:44:23 XXX UTC Medium 2008-02-05T18:30:30 = 05-XXX-2008 6:30:30 XXX 1995-12-22T09:05:02 = 22-XXX-1995 9:05:02 XXX -0010-09-15T04:44:23 = 15-XXX--10 4:44:23 XXX Short 2008-02-05T18:30:30 = 05/02/08 6:30 XXX 1995-12-22T09:05:02 = 22/12/95 9:05 XXX -0010-09-15T04:44:23 = 15/09/-10 4:44 XXX Default 2008-02-05T18:30:30 = 05-XXX-2008 6:30:30 XXX 1995-12-22T09:05:02 = 22-XXX-1995 9:05:02 XXX -0010-09-15T04:44:23 = 15-XXX--10 4:44:23 XXX Available Formats d (d) 2008-02-05T18:30:30 = 5 1995-12-22T09:05:02 = 22 -0010-09-15T04:44:23 = 15 EEEd (d EEE) 2008-02-05T18:30:30 = 5 XXX 1995-12-22T09:05:02 = 22 XXX -0010-09-15T04:44:23 = 15 XXX Hm (H:mm) 2008-02-05T18:30:30 = 18:30 1995-12-22T09:05:02 = 9:05 -0010-09-15T04:44:23 = 4:44 hm (h:mm a) 2008-02-05T18:30:30 = 6:30 XXX 1995-12-22T09:05:02 = 9:05 XXX -0010-09-15T04:44:23 = 4:44 XXX Hms (H:mm:ss) 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 9:05:02 -0010-09-15T04:44:23 = 4:44:23 hms (h:mm:ss a) 2008-02-05T18:30:30 = 6:30:30 XXX 1995-12-22T09:05:02 = 9:05:02 XXX -0010-09-15T04:44:23 = 4:44:23 XXX M (L) 2008-02-05T18:30:30 = 2 1995-12-22T09:05:02 = 12 -0010-09-15T04:44:23 = 9 Md (M-d) 2008-02-05T18:30:30 = 2-5 1995-12-22T09:05:02 = 12-22 -0010-09-15T04:44:23 = 9-15 MEd (E, M-d) 2008-02-05T18:30:30 = XXX, 2-5 1995-12-22T09:05:02 = XXX, 12-22 -0010-09-15T04:44:23 = XXX, 9-15 MMdd (dd/MM) 2008-02-05T18:30:30 = 05/02 1995-12-22T09:05:02 = 22/12 -0010-09-15T04:44:23 = 15/09 MMM (LLL) 2008-02-05T18:30:30 = XXX 1995-12-22T09:05:02 = XXX -0010-09-15T04:44:23 = XXX MMMd (MMM d) 2008-02-05T18:30:30 = XXX 5 1995-12-22T09:05:02 = XXX 22 -0010-09-15T04:44:23 = XXX 15 MMMEd (E MMM d) 2008-02-05T18:30:30 = XXX XXX 5 1995-12-22T09:05:02 = XXX XXX 22 -0010-09-15T04:44:23 = XXX XXX 15 MMMMd (MMMM d) 2008-02-05T18:30:30 = XXX 5 1995-12-22T09:05:02 = XXX 22 -0010-09-15T04:44:23 = XXX 15 MMMMdd (dd MMMM) 2008-02-05T18:30:30 = 05 XXX 1995-12-22T09:05:02 = 22 XXX -0010-09-15T04:44:23 = 15 XXX MMMMEd (E MMMM d) 2008-02-05T18:30:30 = XXX XXX 5 1995-12-22T09:05:02 = XXX XXX 22 -0010-09-15T04:44:23 = XXX XXX 15 ms (mm:ss) 2008-02-05T18:30:30 = 30:30 1995-12-22T09:05:02 = 05:02 -0010-09-15T04:44:23 = 44:23 y (y) 2008-02-05T18:30:30 = 2008 1995-12-22T09:05:02 = 1995 -0010-09-15T04:44:23 = -10 yM (y-M) 2008-02-05T18:30:30 = 2008-2 1995-12-22T09:05:02 = 1995-12 -0010-09-15T04:44:23 = -10-9 yMEd (EEE, y-M-d) 2008-02-05T18:30:30 = XXX, 2008-2-5 1995-12-22T09:05:02 = XXX, 1995-12-22 -0010-09-15T04:44:23 = XXX, -10-9-15 yMMM (y MMM) 2008-02-05T18:30:30 = 2008 XXX 1995-12-22T09:05:02 = 1995 XXX -0010-09-15T04:44:23 = -10 XXX yMMMEd (EEE, y MMM d) 2008-02-05T18:30:30 = XXX, 2008 XXX 5 1995-12-22T09:05:02 = XXX, 1995 XXX 22 -0010-09-15T04:44:23 = XXX, -10 XXX 15 yMMMM (y MMMM) 2008-02-05T18:30:30 = 2008 XXX 1995-12-22T09:05:02 = 1995 XXX -0010-09-15T04:44:23 = -10 XXX yQ (y Q) 2008-02-05T18:30:30 = 2008 1 1995-12-22T09:05:02 = 1995 4 -0010-09-15T04:44:23 = -10 3 yQQQ (y QQQ) 2008-02-05T18:30:30 = 2008 Q1 1995-12-22T09:05:02 = 1995 Q4 -0010-09-15T04:44:23 = -10 Q3 yyMM (MM/yy) 2008-02-05T18:30:30 = 02/08 1995-12-22T09:05:02 = 12/95 -0010-09-15T04:44:23 = 09/-10 yyQ (Q yy) 2008-02-05T18:30:30 = 1 08 1995-12-22T09:05:02 = 4 95 -0010-09-15T04:44:23 = 3 -10 yyyyMMMM (MMMM y) 2008-02-05T18:30:30 = XXX 2008 1995-12-22T09:05:02 = XXX 1995 -0010-09-15T04:44:23 = XXX -10 Miscellaneous Prefers 24 hour time? No Local first day of the week XXX SUPPORT
See DateTime::Locale. AUTHOR
Dave Rolsky <autarch@urth.org> COPYRIGHT
Copyright (c) 2008 David Rolsky. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This module was generated from data provided by the CLDR project, see the LICENSE.cldr in this distribution for details on the CLDR data's license. perl v5.18.2 2017-10-06 DateTime::Locale::gez(3)
All times are GMT -4. The time now is 03:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy