Deleting timestamp using sed command


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Deleting timestamp using sed command
# 1  
Old 04-12-2006
Deleting timestamp using sed command

Hi,

I'm trying to compare Actual.html with a baseline.html
However, everytime it fails b'coz of the timestamp differences
between the two. So, thought of stripping off the timestamp
from both the *html files before comparing using below sed
command over Solaris Unix platform:
s#z):[^/]*/#z):DATE/#g
s#y):[^/]*/#y):DATE/#g
But, its not working for me and doubt if '):' is causing the
problem. Could someone pls pls help me in getting around
this issue. I'm stuck forever without knowing how to tweak.

Pls help it little urgent,
Latha.
# 2  
Old 04-12-2006
would it be possible for you to post two sample lines from your file and how you want the output to be...
# 3  
Old 04-12-2006
Hi Mahendra!

Below are the 3 lines from the *html file
------------------------------------------------------------------
Date Mask 1 (yyyy.MM.dd G HH:mm:ss z): 2006.04.12 AD 20:17:17 IST
Date Mask 2 (MM/dd/yyyy HH:mm:ss z): 04/12/2006 20:17:17 IST
Date Mask 3 (MM/dd/yy): 04/12/06
------------------------------------------------------------------
to be replaced with
-----------------------------------------------------------------
Date Mask 1 (yyyy.MM.dd G HH:mm:ss z): DATE
Date Mask 2 (MM/dd/yyyy HH:mm:ss z): DATE
Date Mask 3 (MM/dd/yy): DATE
----------------------------------------------------------------

Any clues?
# 4  
Old 04-13-2006
sed 's#):.*$#): DATE#g' <filename> will work...

Iam bit confused why you have used / after DATE ?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed command within script wrongly deleting the last line

Hi, I have a shell script which has a for loop that scans list of files and do find and replace few variables using sed command. While doing this, it deletes the last line of all input file which is something wrong. how to fix this. please suggest. When i add an empty line in all my input file,... (5 Replies)
Discussion started by: rbalaj16
5 Replies

2. Shell Programming and Scripting

sed with Timestamp

Hi, I would like to replace a "." with timestamp. Constraint : I am making use of an existing shell script(called by a C program ) which reads the sed command from a properties file.I cant use/pass variables Line in C program - $(echo ${filename} | sed "$TRANSFORM" $TRANSFORM is populated... (4 Replies)
Discussion started by: mohanpadamata
4 Replies

3. Shell Programming and Scripting

sed command throwing error while deleting a line from a file

Hi all, I ahve a program which has to delete a line in a file... if i run the sed command through shell prompt it works fine. But if run it using code its throwing error. May i know where i am doing wrong. the file has 3 lines # cat /root/.ssh/known_hosts... (4 Replies)
Discussion started by: vivek d r
4 Replies

4. UNIX for Dummies Questions & Answers

Deleting file basing on the timestamp substring in the file name

Hello, I have in my backup folder, files with names convention like this : randomFileNames_13-02-2014_23h13m09+1392333189 randomFileNames_14-02-2014_02h13m09+1392343989 randomFileNames_14-02-2014_04h13m09+1392351189 etc.... Base on timestamp at end of the filename, I would to delete all the... (7 Replies)
Discussion started by: thuyetti
7 Replies

5. Shell Programming and Scripting

sed finds nothing but it changes file's timestamp

I must go through some files to change a certain string within text files to another string. I use openSUSE and folders are mounted by cifs. Text to be replaced (only in .m extension) is U:\FOLDER and new string is N: That works fine with spaces in directory names etc., but this process ... (5 Replies)
Discussion started by: Pappa41
5 Replies

6. Shell Programming and Scripting

Fix timestamp with Sed or Awk

Hi I am dealing with the following string: Date: Thur, 13 March 2011 01:01:10 +0000 I asked for help in another topic that converted a similar string: Date: Thur, 13 March 2011 9:50 AM To a 24 hr standard. The problem is that it comes out as: Date: Thur, 13 March 2011 9:50:00 +0000... (4 Replies)
Discussion started by: duonut
4 Replies

7. Shell Programming and Scripting

deleting blank line and row containing certain words in single sed command

Hi Is it possible to do the following in a single command /usr/xpg4/bin/sed -e '/rows selected/d' /aemu/CALLAUTO/callauto.txt > /aemu/CALLAUTO/callautonew.txt /usr/xpg4/bin/sed -e '/^$/d' /aemu/CALLAUTO/callautonew.txt > /aemu/CALLAUTO/callauto_new.txt exit (1 Reply)
Discussion started by: aemunathan
1 Replies

8. Shell Programming and Scripting

deleting text records with sed (sed paragraphs)

Hi all, First off, Thank you all for the knowledge I have gleaned from this site! Deleting Records from a text file... sed paragraphs The following code works nearly perfect, however each time it is run on the log file it adds a newline at the head of the file, run it 5 times, it'll have 5... (1 Reply)
Discussion started by: Festus Hagen
1 Replies

9. Shell Programming and Scripting

Separate date timestamp use awk or sed command ?

Hi, I have logfile like this : Actually the format is date format : yyyymmddHHMMSS and i want the log become this format yyyy-mm-dd HH:MM:SS for example 2009-07-19 11:46:52 Can somebody help me ? Thanks in advance (3 Replies)
Discussion started by: justbow
3 Replies

10. UNIX for Dummies Questions & Answers

deleting file with timestamp

I am using UNIX from few months, I want to delete files in subdirectories that have a timestamp till yesterday. I mean all the files before Jan 10th... can I just give find and do it or how do I do it??? (2 Replies)
Discussion started by: jcluvme
2 Replies
Login or Register to Ask a Question