Sponsored Content
Top Forums Shell Programming and Scripting Replace x Number of String Occurrence with Sed Post 302486819 by DGPickett on Monday 10th of January 2011 10:52:26 AM
Old 01-10-2011
If you could find the first line number to change, like 250 in this example, then it is not hard:
Code:
sed '250,$s/use five-minute-interval/use four-minute-interval/g' services.cfg

Same line works in vi with ':', ex, ed. Usually, you find the first line in vi and say ':.,$s . . . .'
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Search and replace to first occurrence of string

Hi all, I have a very large; delimited file. In vi I would like to replace: CSACT_DY;AVG_UEACT1;uesPerActiveLinkSetSize_1;#;A CSACT_DY;AVG_UEACT2;uesPerActiveLinkSetSize_2;#;A CSACT_DY;AVG_UEACT3;uesPerActiveLinkSetSize_3;#;A with: CSACT_DY;AVG_UEACT1;Average... (7 Replies)
Discussion started by: gilmord
7 Replies

2. Shell Programming and Scripting

SED replace string by occurrence

hi all, I have a text file with following content PAGENUMBER asasasa asasasa PAGENUMBER sasasasasa PAGENUMBER using sed i want to replace PAGENUMBER by occurrence count eg 1 asasasa asasasa 2 sasasasasa 3 (4 Replies)
Discussion started by: uttamhoode
4 Replies

3. Shell Programming and Scripting

Sed to print a string until the second occurrence of a character

Hi, I am totally new to shell scripting. I have a String "c:\working\html\index.txt.12-12-2009.bkp" I want to check if the string has more than one "." character. If it does I would like to retrieve only "c:\working\html\index.txt" i.e, discard the second occurrence of "." and the rest of the... (7 Replies)
Discussion started by: imr
7 Replies

4. UNIX for Dummies Questions & Answers

Sed to replace second number in a random string

I need a sed line that will take STDM111 and change it to STDM161 the STDM will always be constant but the 3 numbers after will be random, I just need it to always replace the middle number with 6 regardless of what the numbers are. (8 Replies)
Discussion started by: glev2005
8 Replies

5. Shell Programming and Scripting

SED to replace exact match, not first occurrence.

Lets say I have file.txt: (Product:Price:QuantityAvailable) (: as delimiter) Chocolate:5:5 Banana:33:3 I am doing a edit/update function. I want to change the Quantity Available, so I tried using the SED command to replace 5, but my Price which is also 5 is changed instead. (for the Banana... (13 Replies)
Discussion started by: andylbh
13 Replies

6. Shell Programming and Scripting

find string nth occurrence in file and print line number

Hi I have requirement to find nth occurrence in a file and capture data from with in lines (between lines) Data in File. <QUOTE> <SESSION> <ATTRIBUTE NAME='Parameter Filename' VALUE='file1.parm'/> <ATTRIBUTE NAME='Service Name' VALUE='None'/> </SESSION> <SESSION> <ATTRIBUTE... (6 Replies)
Discussion started by: tmalik79
6 Replies

7. Shell Programming and Scripting

Sed diffrent replace by occurrence

I couldn't find the answer anywhere, so I hope you could help me. I need to change something like the following: something/bla/aaaa anything/bbb to: something --bla ----aaaa anything --bbb How do I do this? Is it possible with sed? I tried various patterns, but don't know how to... (5 Replies)
Discussion started by: Patwan
5 Replies

8. Shell Programming and Scripting

Count number of occurrence of a string in file

if there's a file containing: money king money queen money cat money also money king all those strings are on one line in the file. how can i find out how many times "money king" shows up in the line? egrep -c "money king" wont work. (7 Replies)
Discussion started by: SkySmart
7 Replies

9. AIX

Replace consecutive occurrence of string in same line

Hi All, I have a requirement to replace consecutive occurence of same string nedd to be replaced. Below is the input and desired output. Input: --------- 123.5|ABC|.|.|. 234.4|DEF|.|.|.|.|.| Output: --------- 123.5|ABC|||. 234.4|DEF||||| so basically "|.|" need to be replaced with... (9 Replies)
Discussion started by: ureddy
9 Replies

10. Shell Programming and Scripting

Replace first occurrence of a string in while loop

####Solved#### Hello, My aim is to replace searched string with incremented value under ubuntu 16.04. Example: aasasasas 9030 31wwo weopwoep weerasas 9030 ew31wo ieopwoep bbqqqsas 9030 ew3swo ieeopwoep ccsaqpas 9030 ewiro o2opwoep Expected: aasasasas 9030 31wwo weopwoep weerasas 9031... (2 Replies)
Discussion started by: baris35
2 Replies
DateTime::Locale::tn_ZA(3)				User Contributed Perl Documentation				DateTime::Locale::tn_ZA(3)

NAME
DateTime::Locale::tn_ZA SYNOPSIS
use DateTime; my $dt = DateTime->now( locale => 'tn_ZA' ); print $dt->month_name(); DESCRIPTION
This is the DateTime locale package for Tswana South Africa. DATA
This locale inherits from the DateTime::Locale::tn locale. It contains the following data. Days Wide (format) Mosopulogo Labobedi Laboraro Labone Labotlhano Matlhatso Tshipi Abbreviated (format) Mos Bed Rar Ne Tla Mat Tsh Narrow (format) 2 3 4 5 6 7 1 Wide (stand-alone) Mosopulogo Labobedi Laboraro Labone Labotlhano Matlhatso Tshipi Abbreviated (stand-alone) Mos Bed Rar Ne Tla Mat Tsh Narrow (stand-alone) 2 3 4 5 6 7 1 Months Wide (format) Ferikgong Tlhakole Mopitlo Moranang Motsheganang Seetebosigo Phukwi Phatwe Lwetse Diphalane Ngwanatsele Sedimonthole Abbreviated (format) Fer Tlh Mop Mor Mot See Phu Pha Lwe Dip Ngw Sed Narrow (format) 1 2 3 4 5 6 7 8 9 10 11 12 Wide (stand-alone) Ferikgong Tlhakole Mopitlo Moranang Motsheganang Seetebosigo Phukwi Phatwe Lwetse Diphalane Ngwanatsele Sedimonthole Abbreviated (stand-alone) Fer Tlh Mop Mor Mot See Phu Pha Lwe Dip Ngw Sed Narrow (stand-alone) 1 2 3 4 5 6 7 8 9 10 11 12 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 BC AD Abbreviated BC AD Narrow BC AD Date Formats Full 2008-02-05T18:30:30 = Labobedi, 2008 Tlhakole 05 1995-12-22T09:05:02 = Labotlhano, 1995 Sedimonthole 22 -0010-09-15T04:44:23 = Matlhatso, -10 Lwetse 15 Long 2008-02-05T18:30:30 = 2008 Tlhakole 5 1995-12-22T09:05:02 = 1995 Sedimonthole 22 -0010-09-15T04:44:23 = -10 Lwetse 15 Medium 2008-02-05T18:30:30 = 2008 Tlh 5 1995-12-22T09:05:02 = 1995 Sed 22 -0010-09-15T04:44:23 = -10 Lwe 15 Short 2008-02-05T18:30:30 = 08/02/05 1995-12-22T09:05:02 = 95/12/22 -0010-09-15T04:44:23 = -10/09/15 Default 2008-02-05T18:30:30 = 2008 Tlh 5 1995-12-22T09:05:02 = 1995 Sed 22 -0010-09-15T04:44:23 = -10 Lwe 15 Time Formats Full 2008-02-05T18:30:30 = 18:30:30 UTC 1995-12-22T09:05:02 = 09:05:02 UTC -0010-09-15T04:44:23 = 04:44:23 UTC Long 2008-02-05T18:30:30 = 18:30:30 UTC 1995-12-22T09:05:02 = 09:05:02 UTC -0010-09-15T04:44:23 = 04:44:23 UTC Medium 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 09:05:02 -0010-09-15T04:44:23 = 04:44:23 Short 2008-02-05T18:30:30 = 18:30 1995-12-22T09:05:02 = 09:05 -0010-09-15T04:44:23 = 04:44 Default 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 09:05:02 -0010-09-15T04:44:23 = 04:44:23 Datetime Formats Full 2008-02-05T18:30:30 = Labobedi, 2008 Tlhakole 05 18:30:30 UTC 1995-12-22T09:05:02 = Labotlhano, 1995 Sedimonthole 22 09:05:02 UTC -0010-09-15T04:44:23 = Matlhatso, -10 Lwetse 15 04:44:23 UTC Long 2008-02-05T18:30:30 = 2008 Tlhakole 5 18:30:30 UTC 1995-12-22T09:05:02 = 1995 Sedimonthole 22 09:05:02 UTC -0010-09-15T04:44:23 = -10 Lwetse 15 04:44:23 UTC Medium 2008-02-05T18:30:30 = 2008 Tlh 5 18:30:30 1995-12-22T09:05:02 = 1995 Sed 22 09:05:02 -0010-09-15T04:44:23 = -10 Lwe 15 04:44:23 Short 2008-02-05T18:30:30 = 08/02/05 18:30 1995-12-22T09:05:02 = 95/12/22 09:05 -0010-09-15T04:44:23 = -10/09/15 04:44 Default 2008-02-05T18:30:30 = 2008 Tlh 5 18:30:30 1995-12-22T09:05:02 = 1995 Sed 22 09:05:02 -0010-09-15T04:44:23 = -10 Lwe 15 04:44:23 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 Bed 1995-12-22T09:05:02 = 22 Tla -0010-09-15T04:44:23 = 15 Mat 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 PM 1995-12-22T09:05:02 = 9:05 AM -0010-09-15T04:44:23 = 4:44 AM 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 PM 1995-12-22T09:05:02 = 9:05:02 AM -0010-09-15T04:44:23 = 4:44:23 AM 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 = Bed, 2-5 1995-12-22T09:05:02 = Tla, 12-22 -0010-09-15T04:44:23 = Mat, 9-15 MMM (LLL) 2008-02-05T18:30:30 = Tlh 1995-12-22T09:05:02 = Sed -0010-09-15T04:44:23 = Lwe MMMd (MMM d) 2008-02-05T18:30:30 = Tlh 5 1995-12-22T09:05:02 = Sed 22 -0010-09-15T04:44:23 = Lwe 15 MMMEd (E MMM d) 2008-02-05T18:30:30 = Bed Tlh 5 1995-12-22T09:05:02 = Tla Sed 22 -0010-09-15T04:44:23 = Mat Lwe 15 MMMMd (MMMM d) 2008-02-05T18:30:30 = Tlhakole 5 1995-12-22T09:05:02 = Sedimonthole 22 -0010-09-15T04:44:23 = Lwetse 15 MMMMEd (E MMMM d) 2008-02-05T18:30:30 = Bed Tlhakole 5 1995-12-22T09:05:02 = Tla Sedimonthole 22 -0010-09-15T04:44:23 = Mat Lwetse 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 = Bed, 2008-2-5 1995-12-22T09:05:02 = Tla, 1995-12-22 -0010-09-15T04:44:23 = Mat, -10-9-15 yMMM (y MMM) 2008-02-05T18:30:30 = 2008 Tlh 1995-12-22T09:05:02 = 1995 Sed -0010-09-15T04:44:23 = -10 Lwe yMMMEd (EEE, y MMM d) 2008-02-05T18:30:30 = Bed, 2008 Tlh 5 1995-12-22T09:05:02 = Tla, 1995 Sed 22 -0010-09-15T04:44:23 = Mat, -10 Lwe 15 yMMMM (y MMMM) 2008-02-05T18:30:30 = 2008 Tlhakole 1995-12-22T09:05:02 = 1995 Sedimonthole -0010-09-15T04:44:23 = -10 Lwetse 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 yyQ (Q yy) 2008-02-05T18:30:30 = 1 08 1995-12-22T09:05:02 = 4 95 -0010-09-15T04:44:23 = 3 -10 Miscellaneous Prefers 24 hour time? Yes Local first day of the week Mosopulogo 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::tn_ZA(3)
All times are GMT -4. The time now is 03:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy