Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Change time with current year Post 302666189 by itkamaraj on Wednesday 4th of July 2012 01:22:15 AM
Old 07-04-2012
Code:
 
$ awk -v d=`date +%Y` '{sub(/[0-9][0-9]:[0-9][0-9]/,d)}1' input.txt
hostname 2007-Feb-9 /u100/DEVCO/Patching a.log
hostname 2010-Jun-25 /u100/DEVCO/DumpCleaner a.log
hostname 2011-Jun-25 /u100/DEVCO/DumpCleaner/sample a.log
hostname 2012-Jun-25 /u100/DEVCO/DumpCleaner/sample b.log
hostname 2012-Jun-25 /u100/DEVCO/DumpCleaner/Recycle a.log
hostname 2012-Jun-25 /u100/DEVCO/DumpCleaner/Recycle b.log

use nawk in solaris

use the code tag, next time

https://www.unix.com/how-post-unix-li...code-tags.html
This User Gave Thanks to itkamaraj For This Post:
 

10 More Discussions You Might Find Interesting

1. IP Networking

change my current IP address

Dear All , I have Sun Solaris 8 machine . during installation i gave the machine ip address 192.168.0.50 and gatway 192.168.0.1 . now i hvae to change the IP address and the gateway ! how ?? i know i have to use ifconfig , but how can i change it and the gateway ??? also where from i... (4 Replies)
Discussion started by: tamemi
4 Replies

2. Solaris

change year in the server

HOw do I change the year in Solaris server. I changed the timezone to IST which caused the year to change to 2015. How do I change the year?? (1 Reply)
Discussion started by: krishan
1 Replies

3. Shell Programming and Scripting

read file and print additional rows till current year

Hi all i have a file like 2006,1,2 2007,2,3 2008,3,4 I will read this and my output should be like 2006,1,2 2007,1,2 2008,1,2 2007,2,3 2008,2,3 2008,3,4 Giving the explanation, we will read the first line of the file and if the year any other than current year, we will print as many... (1 Reply)
Discussion started by: vasuarjula
1 Replies

4. UNIX for Dummies Questions & Answers

comparing field to current year

Hi, I have a comma delimited file that contains name, account number, and account date/time(example record below). I want to pull off all the records that have an account date greater than 8/1 of the current year, and create a new file with those records. So for this year, it would take... (6 Replies)
Discussion started by: keeferb
6 Replies

5. Post Here to Contact Site Administrators and Moderators

change the year in the event prediction market

Can you change the year in the event prediction market Facebook Stock Will Be Over $70 a Share By the End of 2102? (Closes for placing Bits on 09-30-12 - 10:30 PM) (8 Replies)
Discussion started by: itkamaraj
8 Replies

6. Shell Programming and Scripting

How to pass current year and month in FOR LOOP in UNIX shell scripting?

Hi Team, I have created a script and using FOR LOOP like this and it is working fine. for Month in 201212 201301 201302 201303 do echo "Starting the statistics gathering of $Month partitions " done But in my scripts the " Month " variable is hard-coded. Can you please any one... (3 Replies)
Discussion started by: shoan
3 Replies

7. Slackware

/boot: how do I change the current kernel?

Slackware 14.0 Hi: I once changed the smp kernel running in my system by another one in /boot. What I did was to relink /boot/System.map, /boot/vmlinuz and /boot/config. But I don't remember if I did something else. Would that alone be OK. (4 Replies)
Discussion started by: stf92
4 Replies

8. Shell Programming and Scripting

Displaying current date time of EDT in IST time

Hi Folks, My server time is in EDT. And i am sending automated mails from that server in which i need to display the current date time as per IST (GMT+5:30). Please advice how to display the date time as per IST. IST time leads 9:30 mins to EDT. and i wrote something like below. ... (6 Replies)
Discussion started by: Showdown
6 Replies

9. Shell Programming and Scripting

To get the time exactly 24hrs from the current time

Hi guys, I am having file which contains below data. 2012-04-24 08:40:13 10739022730 1027699274PersonInfoShipTO details missing FirstName,LastName, 2012-04-24 08:40:13 10739022730 1027699274PersonInfoShipTO details missing FirstName,LastName, 2012-04-24 08:40:13 ... (2 Replies)
Discussion started by: mohanalakshmi
2 Replies

10. Shell Programming and Scripting

Convert UTC time into current UNIX sever time zone

Hi guys thanks for the help for my previous posts.Now i have a requirement that i download a XMl file which has UTC time stamp.I need to convert UTC time into Unix server timezone. For ex if the time zone of unix server is CDT then i need to convert into CDT.whatever may be the system time... (5 Replies)
Discussion started by: mohanalakshmi
5 Replies
sttime(3)						    ShapeTools Toolkit Library							 sttime(3)

NAME
stMktime, stWriteTime - date and time handling SYNOPSIS
#include <config.h> #include <sttk.h.h> time_tstMktime (char *string); char*stWriteTime (time_t date); DESCRIPTION
stMktime scans the given string and tries to read a date and time from it. It understands various formats of date strings. The following is a list of all valid formats, optional parts in brackets. [Tue] Jan 5[,] [19]93 This includes the standard asctime(3) format. Jan 5 With no year given, the year defaults to the current year. [19]93/01/05 This notation requires month and day represented by exactly two digits. 5.1.[19]93 This is the usual German notation. 5.1. German notation referencing the current year. A certain time, given together with the date must always have the following form. hours:minutes[:seconds] Each of the fields must be an integer value within the proper range (hours: 0-23, minutes and seconds: 0-59). Values below 10 may be written as one digit numbers. The time value may be placed anywhere in the date string: at the beginning, at the end, or somewhere in the middle. Any amount of white- space may be given between a field of the time value and the separating colon. The time is always considered to be local time. stWriteTime generates a time string similar to asctime(3) from its date argument. SEE ALSO
asctime(3) BUGS
Time Zone Names within the time string (like `MET') are not handled properly. In most cases they will cause a failure. sttk-1.7 Thu Jun 24 17:43:35 1993 sttime(3)
All times are GMT -4. The time now is 11:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy