Sponsored Content
Top Forums UNIX for Beginners Questions & Answers File manipulation place 0 before the number using sed Post 303039601 by RudiC on Thursday 10th of October 2019 04:26:10 AM
Old 10-10-2019
In case there are other occurrences of three letters followed by a space and a digit, you might want to narrow down the search pattern to the locale months:
Code:
sed -r "s/($(locale abmon | tr ';' '|')) ([[:digit:]] )/\1 0\2/g" file

Be aware that you need sed to recognize / handle EREs for this simple tr approach.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

file name Manipulation using sed

Hi, I have a file name, for which I want to strip out the first bit and leave the rest... So I want to take the file name .lockfile-filename.10001 ,strip it and have only filename.10001 ... Thanking you all inadvance, Zak (6 Replies)
Discussion started by: Zak
6 Replies

2. Shell Programming and Scripting

Place number with awk

Hello, if I've a list of number 23 34 56 78 how I can place a sequence of ordinated number in a boundary column so 1 23 2 34 3 56 4 78 Thanks in advance! (3 Replies)
Discussion started by: cv313x
3 Replies

3. Shell Programming and Scripting

Read a number from file and place it back

Hi All, I want to read one number from the file. Only one number will be there in the file. then i have to increment the number in my script and put it back in the same file. Is it possible? Can anybody help me? Thanks, Vinay (6 Replies)
Discussion started by: vinayakatj56
6 Replies

4. Shell Programming and Scripting

File manipulation with AWK and SED

Hello How do i check that correct input files are used while using AWk and SED for file manipulation? e.g awk '/bin/ {print $0 }' shell.txt sed 's/hp/samsung/' printers.txt how do i ensure that the correct input files I am working with are used? (5 Replies)
Discussion started by: Pauline mugisha
5 Replies

5. Shell Programming and Scripting

SED/AWK file read & manipulation

I have large number of data files, close to 300 files, lets say all files are same kind and have extension .dat , each file have mulitple lines in it. There is a unique line in each file containing string 'SERVER'. Right after this line there is another line which contain a string 'DIGIT=0',... (4 Replies)
Discussion started by: sal_tx
4 Replies

6. Shell Programming and Scripting

setter and getter functions for file manipulation with sed

Hi, I would really appreciate some help, I couldn't nail my problem: I would like to create some setter and getter functions to make my life easier. my sample file contains: keyword - some tabs - value - semicolon number 12.1; float .3; double 12; real 12.2324; stuff .234; decimal... (5 Replies)
Discussion started by: Toorop
5 Replies

7. Shell Programming and Scripting

Help with number field manipulation

I have a comma separated file containing numbers, I would like to read the file and divide each number by 1024 and create an output file. Input file : 50312.00,3434.05, ,3433.34,124344.00,434343.00, , , Output file: 49.13,3.35,3.35,0,12.05,424.16,0,0 Please click this link: How to... (2 Replies)
Discussion started by: inditopgun
2 Replies

8. Shell Programming and Scripting

Use GREP to count number of records and place it in a variable

I am trying to count the number of records from different files using grep, and then place the result in a separate variable for each file, so at the end of my shell script, I can sum all the variables and check if the number of records are equal to what I was expecting. It is weird butwc -ldoes... (2 Replies)
Discussion started by: dhruuv369
2 Replies

9. Shell Programming and Scripting

sed flat file manipulation

Hello, I have a large flat file where i need to change data in columns 131-133 based on what is in columns 172-173. I am not sure if I need to read the file line by line and make the change or if I can do this in a single statement. thank you (3 Replies)
Discussion started by: gblmin
3 Replies

10. Shell Programming and Scripting

Zero padding a Number before and after a decimal place

Hi I was hoping someone could help me with a sed script I am trying to write? I am on a Mac running ElCapitan I have some text that I have converted from a pdf that I want to format into an xml file. In the file I have managed to delete all the text I do not need. The text I have left is... (8 Replies)
Discussion started by: Paul Walker
8 Replies
DateTime::Locale::Base(3pm)				User Contributed Perl Documentation			       DateTime::Locale::Base(3pm)

NAME
DateTime::Locale::Base - DateTime locale package for "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.10.1 2010-03-19 DateTime::Locale::Base(3pm)
All times are GMT -4. The time now is 11:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy