Sponsored Content
Top Forums UNIX for Beginners Questions & Answers How to identify delimiter to find and replace a string with sed? Post 303040515 by duke0001 on Wednesday 30th of October 2019 03:35:43 PM
Old 10-30-2019
RudiC:

To write months verbatim and escape, it didn't work either. I need sed identify months because 4 quarters have 4 different begin date and 4 end date. Hard code will not work. I tried something. Please see all output below. Here, $NEWDATE=01-OCT-2019.

Code:
/home/oracle> sed  "s/[0-3][0-9]-\(JUN\|JUL\|AUG\)-[12][09][0-9]\{2\}/$NEWDATE/" test4.txt
       ep.begin_date, ep.end_date, ep.facility_code,
AND    ep.begin_date <= '01-JUL-2019'
       ep.begin_date, ep.end_date, ep.facility_code,
AND    ep.begin_date <= '01-JUL-2019'
       ep.begin_date, ep.end_date, ep.facility_code,
AND    ep.begin_date <= '01-JUL-2019'

/home/oracle/> sed  "s/[0-3][0-9]\-[a-zA-Z]{3}\-[12][09][0-9]\{2\}/$NEWDATE/" test4.txt
       ep.begin_date, ep.end_date, ep.facility_code,
AND    ep.begin_date <= '01-JUL-2019'
       ep.begin_date, ep.end_date, ep.facility_code,
AND    ep.begin_date <= '01-JUL-2019'
       ep.begin_date, ep.end_date, ep.facility_code,
AND    ep.begin_date <= '01-JUL-2019'

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to find a certain string in a file and replace it with a value from another file using sed/awk?

Hi Everyone, I am new to this forum and new to sed/awk programming too !! I need to find particular string in file1(text file) and replace it with a value from another text file(file2) the file2 has only one line and the value to be replaced with is in the second column. file 1: (assert (=... (21 Replies)
Discussion started by: paramad
21 Replies

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

3. Shell Programming and Scripting

Help identify string using sed

I have the following output and would like to only identify strings with "vw" at the end. Here is the file contents: SELECT n.contract_num, n.descr, s.prj_level2_cf_val, r.descr, r.project_id, p.offering_id, o.n_cust_contract, u.name1, ' ', ' ', SUM (0), TO_CHAR (t.start_dt, 'YYYY-MM-DD'),... (6 Replies)
Discussion started by: bobroberts369
6 Replies

4. Shell Programming and Scripting

QUESTION1: grep only exact string. QUESTION2: find and replace only exact value with sed

QUESTION1: How do you grep only an exact string. I am using Solaris10 and do not have any GNU products installed. Contents of car.txt CAR1_KEY0 CAR1_KEY1 CAR2_KEY0 CAR2_KEY1 CAR1_KEY10 CURRENT COMMAND LINE: WHERE VARIABLE CAR_NUMBER=1 AND KEY_NUMBER=1 grep... (1 Reply)
Discussion started by: thibodc
1 Replies

5. Shell Programming and Scripting

Using sed in ksh to find and replace string

Hi All, I have a file in which contains location of various data files. I want to change locations using sed. Find and replace strings are in a separate file. Content of this file (/tmp/tt) - /dd/pp/test/test/1/ /pp/aa/test/dg1/ /dd/pp/test/test/2/ /pp/aa/test/dg2/ /dd/pp/test/test/3/... (2 Replies)
Discussion started by: pandeyra
2 Replies

6. Shell Programming and Scripting

sed or awk command to replace a string pattern with another string based on position of this string

here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb cat dump.sql INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Discussion started by: vivek d r
10 Replies

7. Shell Programming and Scripting

HPUX find string in directory and filetype and replace string

Hi, Here's my dilemma. I need to replace the string Sept_2012 to Oct_2012 in all *config.py files within the current directory and below directories Is this possible? Also I am trying to find all instances of the string Sept_2012 within files in the current directory and below I have... (13 Replies)
Discussion started by: pure_jax
13 Replies

8. Shell Programming and Scripting

Help with Passing the Output of grep to sed command - to find and replace a string in a file.

I have a file example.txt as follows :SomeTextGoesHere $$TODAY_DT=20140818 $$TODAY_DT=20140818 $$TODAY_DT=20140818I need to automatically update the date (20140818) in the above file, by getting the new date as argument, using a shell script. (It would even be better if I could pass... (5 Replies)
Discussion started by: SriRamKrish
5 Replies

9. Shell Programming and Scripting

Sed: find and replace backwards, until string

Some help please: Need to find string ||(everything in front of it)B0300|| and replace it with ||0|| globally In: 16112121||||0||0||0||0||0||52||52||0||0||0||0||1507200053342B0300||1507200053342B0300||0||0||0||0700 Out: 16112121||||0||0||0||0||0||52||52||0||0||0||0||0||0||0||0||0||0700 ... (4 Replies)
Discussion started by: drbiloukos
4 Replies

10. UNIX for Beginners Questions & Answers

sed find replace after HOST string

Hi Everyone, I have a xml file, where i need to find this HOST=dbhost.domain.com and then replace only dbhost.domain.com with db.one.in so finally it should like this HOST=db.one.in i tried this but its not working. sed -i "s/^HOST=*com$/HOST=db.one.in/g" repository.xml ^... (4 Replies)
Discussion started by: shajay12
4 Replies
DateTime::Locale::Base(3)				User Contributed Perl Documentation				 DateTime::Locale::Base(3)

NAME
DateTime::Locale::Base - Base class for individual locale objects SYNOPSIS
use base 'DateTime::Locale::Base'; DEFAULT FORMATS
Each locale has a set of four default date and time formats. They are distinguished by length, and are called "full", "long", "medium", and "short". Each locale may have a different default length which it uses when its "$locale->date_format_default()", "$locale->time_format_default()", or "$locale->datetime_format_default()" methods are called. This can be changed by calling the "$locale->set_default_date_format()" or "$locale->set_default_time_format()" methods. These methods accept a string which must be one of "full", "long", "medium", or "short". NAME FORMS
Most names come in a number of variations. First, they may vary based on length, with wide, abbreviated, and narrow forms. The wide form is typically the full name, while the narrow form is often a single character. The narrow forms may not be unique. For example, "T" may be used for Tuesday and Thursday in the English narrow forms. Many names also distinguish between "format" and "stand-alone" forms of a pattern. The format pattern is used when the thing in question is being placed into a larger string. The stand-alone form is used when displaying that item by itself, for example in a calendar. METHODS
All locales provide the following methods: o $locale->id() The locale's id. o $locale->language_id() The language portion of the id. o $locale->script_id() The script portion of the id, if any. o $locale->territory_id() The territory portion of the id, if any. o $locale->variant_id() The variant portion of the id, if any. o $locale->name() The full name for the locale in English. o $locale->language() The language name for the locale in English. o $locale->script() The script name for the locale in English, if any. o $locale->territory() The territory name for the locale in English, if any. o $locale->variant() The variant name for the locale in English, if any. o $locale->native_name() The full name for the locale in its native language, if any. o $locale->native_language() The language name for the locale in its native language, if any. o $locale->native_script() The script name for the locale in its native language, if any. o $locale->native_territory() The territory name for the locale in its native language, if any. o $locale->native_variant() The variant name for the locale in its native language, if any. o $locale->month_format_wide() Returns an array reference containing the wide format names of the months, with January as the first month. o $locale->month_format_abbreviated() Returns an array reference containing the abbreviated format names of the months, with January as the first month. o $locale->month_format_narrow() Returns an array reference containing the narrow format names of the months, with January as the first month. o $locale->month_stand_alone_wide() Returns an array reference containing the wide stand-alone names of the months, with January as the first month. o $locale->month_stand_alone_abbreviated() Returns an array reference containing the abbreviated stand-alone names of the months, with January as the first month. o $locale->month_stand_alone_narrow() Returns an array reference containing the narrow stand-alone names of the months, with January as the first month. o $locale->day_format_wide() Returns an array reference containing the wide format names of the days, with Monday as the first day. o $locale->day_format_abbreviated() Returns an array reference containing the abbreviated format names of the days, with Monday as the first day. o $locale->day_format_narrow() Returns an array reference containing the narrow format names of the days, with Monday as the first day. o $locale->day_stand_alone_wide() Returns an array reference containing the wide stand-alone names of the days, with Monday as the first day. o $locale->day_stand_alone_abbreviated() Returns an array reference containing the abbreviated stand-alone names of the days, with Monday as the first day. o $locale->day_stand_alone_narrow() Returns an array reference containing the narrow stand-alone names of the days, with Monday as the first day. o $locale->quarter_format_wide() Returns an array reference containing the wide format names of the quarters. o $locale->quarter_format_abbreviated() Returns an array reference containing the abbreviated format names of the quarters. o $locale->quarter_format_narrow() Returns an array reference containing the narrow format names of the quarters. o $locale->quarter_stand_alone_wide() Returns an array reference containing the wide stand-alone names of the quarters. o $locale->quarter_stand_alone_abbreviated() Returns an array reference containing the abbreviated stand-alone names of the quarters. o $locale->quarter_stand_alone_narrow() Returns an array reference containing the narrow stand-alone names of the quarters. o $locale->era_wide() Returns an array reference containing the wide names of the eras, with "BCE" first. o $locale->era_abbreviated() Returns an array reference containing the abbreviated names of the eras, with "BCE" first. o $locale->era_narrow() Returns an array reference containing the abbreviated names of the eras, with "BCE" first. However, most locales do not differ between the narrow and abbreviated length of the era. o $locale->am_pm_abbreviated() Returns an array reference containing the abbreviated names of "AM" and "PM". o $locale->date_format_long() o $locale->date_format_full() o $locale->date_format_medium() o $locale->date_format_short() Returns the CLDR date pattern of the appropriate length. o $locale->date_formats() Returns a hash reference of CLDR date patterns for the date formats, where the keys are "full", "long", "medium", and "short". o $locale->time_format_long() o $locale->time_format_full() o $locale->time_format_medium() o $locale->time_format_short() Returns the CLDR date pattern of the appropriate length. o $locale->time_formats() Returns a hash reference of CLDR date patterns for the time formats, where the keys are "full", "long", "medium", and "short". o $locale->datetime_format_long() o $locale->datetime_format_full() o $locale->datetime_format_medium() o $locale->datetime_format_short() Returns the CLDR date pattern of the appropriate length. o $locale->datetime_formats() Returns a hash reference of CLDR date patterns for the datetime formats, where the keys are "full", "long", "medium", and "short". o $locale->date_format_default() o $locale->time_format_default() o $locale->datetime_format_default() Returns the default CLDR date pattern. The length of this format is based on the value of "$locale->default_date_format_length()" and/or "$locale->default_time_format_length()". o $locale->default_date_format_length() o $locale->default_time_format_length() Returns the default length for the format, one of "full", "long", "medium", or "short". o $locale->set_default_date_format_length() o $locale->set_default_time_format_length() Sets the default length for the format. This must be one of "full", "long", "medium", or "short". o $locale->prefers_24_hour_time() Returns a boolean indicating the preferred hour format for this locale. o $locale->first_day_of_week() Returns a number from 1 to 7 indicating the local first day of the week, with Monday being 1 and Sunday being 7. For example, for a US locale this returns 7. o $locale->available_formats() A list of format names, like "MMdd" or "yyyyMM". This should be the list directly supported by the subclass, not its parents. o $locale->format_for($key) Given a valid name, returns the CLDR date pattern for that thing, if one exists. SUPPORT
See DateTime::Locale. AUTHORS
Richard Evans <rich@ridas.com> Dave Rolsky <autarch@urth.org> COPYRIGHT
Copyright (c) 2003 Richard Evans. Copyright (c) 2004-2005 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 program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. perl v5.18.2 2017-10-06 DateTime::Locale::Base(3)
All times are GMT -4. The time now is 11:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy