Sponsored Content
Top Forums Shell Programming and Scripting Trying to change date separator with sed Post 302340153 by -Locks- on Monday 3rd of August 2009 01:01:18 AM
Old 08-03-2009
Try

Code:
sed 's:\/:~:g'

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Move A File With Same Date,don't Change The Desitination Dir Date

Assume, I created one file three years back and I like to move the file to some other directory with the old date (Creation date)? Is it possible? Explain? (1 Reply)
Discussion started by: jee.ku2
1 Replies

2. UNIX for Dummies Questions & Answers

Change field separator of grep from : to space

Hi, All, I wonder how to change the field separator of grep from : to space when use grep to display. for example when I use grep -e 'pattern1' -e 'pattern2' -n filename to find patterns, it use : to separate patterns, but I want to use blank space. is there an option I can set to... (2 Replies)
Discussion started by: Jenny.palmy
2 Replies

3. Shell Programming and Scripting

dynamically change awk Field Separator FS

Hi All, I was wondering if anyone knew how to dynamically change the FS in awk to accept vairiable containing a field separator. the current code is as below and does not work when i introduce the dynamic FS change :-( validate_source_file() { source_file=$1 ... (2 Replies)
Discussion started by: satnamx
2 Replies

4. UNIX for Dummies Questions & Answers

Sed - Get Separator From String

Hi All, I have the following data in a korn shell variable: a="FirstValue|SecondValue|ThirdValue" The value between "FirstValue", "SecondValue" and "ThirdValue" can change, in this case is a comma: "," and I need to print it only once. I need to know what is the separator value. I... (3 Replies)
Discussion started by: felipe.vinturin
3 Replies

5. Shell Programming and Scripting

Format of SED command to change a date

I have a website. I have a directory within it with over a hundred .html files. I need to change a date within every file. I don't have an easy way to find/replace. I need to change 10/31 to 11/30 on every single page at once. I tried the command below but it didn't work. Obviously I don't know... (3 Replies)
Discussion started by: ijustsawmars
3 Replies

6. Shell Programming and Scripting

sed to insert a separator

My txt file consists of records with 6 numbers followed by 3 characters. Is there a simple “sed” which will insert a | separator between the 6th and 7th position ? Many thanks (3 Replies)
Discussion started by: malts18
3 Replies

7. Shell Programming and Scripting

Change the content of files but not change the date

I have 100 files in a directory , all the files have a word "error" and they are created in different date . Now I would like to change the word from "error" to "warning" , and keep the date of the files ( that means do not change the file creation date after change the word ) , can advise what can... (0 Replies)
Discussion started by: ust3
0 Replies

8. Shell Programming and Scripting

sed multilines + separator confusion !!

Hi Seders, i am new to this forum, but i think it's quite the best place to post. So, here is my pb : I have a csv file, with comma separator and text enclosed by ". First pb is with text in " ......... ", wich sometimes includes lines break, and commas And to complicate a little more,... (4 Replies)
Discussion started by: yogeek
4 Replies

9. Shell Programming and Scripting

How to change the line separator?

Hi All, I have a file with 20 columns, and the data itself has "\n" new line in it. So we have changed the row delimiter to ^E. Now i am unable to use head, wc -l etc... Please let me know how to change the line separator temporarily to run these unix commands. Thanks. (1 Reply)
Discussion started by: baranisachin
1 Replies

10. Shell Programming and Scripting

Valid separator in time and date format

Hello. I can use any particular (stupid or not) format when using bash date command. Example : ~> date --date "now" '+%Y-%m-%d %H!%M!%S' 2019-06-03 12!55!33or ~> date --date "now" '+%Y£%m£%d %H¤%M¤%S' 2019£06£03 12¤57¤36 or ~> date --date "now" '+%Y-%m-%d %H-%M-%S' 2019-06-03 12-58-51 ... (4 Replies)
Discussion started by: jcdole
4 Replies
DATETIME.SETISODATE(3)							 1						    DATETIME.SETISODATE(3)

DateTime::setISODate - Sets the ISO date

       Object oriented style

SYNOPSIS
public DateTime DateTime::setISODate (int $year, int $week, [int $day = 1]) DESCRIPTION
Procedural style DateTime date_isodate_set (DateTime $object, int $year, int $week, [int $day = 1]) Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates. PARAMETERS
o $object -Procedural style only: A DateTime object returned by date_create(3). The function modifies this object. o $year - Year of the date. o $week - Week of the date. o $day - Offset from the first day of the week. RETURN VALUES
Returns the DateTime object for method chaining or FALSE on failure. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.3.0 | | | | | | | Changed the return value on success from NULL to | | | DateTime. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 DateTime.setISODate(3) example Object oriented style <?php $date = new DateTime(); $date->setISODate(2008, 2); echo $date->format('Y-m-d') . " "; $date->setISODate(2008, 2, 7); echo $date->format('Y-m-d') . " "; ?> Procedural style <?php $date = date_create(); date_isodate_set($date, 2008, 2); echo date_format($date, 'Y-m-d') . " "; date_isodate_set($date, 2008, 2, 7); echo date_format($date, 'Y-m-d') . " "; ?> The above examples will output: 2008-01-07 2008-01-13 Example #2 Values exceeding ranges are added to their parent values <?php $date = new DateTime(); $date->setISODate(2008, 2, 7); echo $date->format('Y-m-d') . " "; $date->setISODate(2008, 2, 8); echo $date->format('Y-m-d') . " "; $date->setISODate(2008, 53, 7); echo $date->format('Y-m-d') . " "; ?> The above example will output: 2008-01-13 2008-01-14 2009-01-04 Example #3 Finding the month a week is in <?php $date = new DateTime(); $date->setISODate(2008, 14); echo $date->format('n'); ?> The above examples will output: 3 SEE ALSO
DateTime.setDate(3), DateTime.setTime(3). PHP Documentation Group DATETIME.SETISODATE(3)
All times are GMT -4. The time now is 09:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy