Sponsored Content
Full Discussion: date manipulating
Top Forums UNIX for Dummies Questions & Answers date manipulating Post 682 by tamer on Sunday 7th of January 2001 11:35:18 AM
Old 01-07-2001
Question

I'm using Kshell scripts cronjobs to logrolling my daily log files and I stamped the log file at the end of the day by date stamp i.e.: %d_%m_%y-LogFile.

but the 22_01_2001-LogFile as example contains 21st Jan data and I want to stamp the log file with previous day.

so I'm trying to subtract one day from the current day but it doesn't work.
like: date +%d-1_%m_%y or date expr +%d - 1 _%m_%y.
or setting the day in variable then subtract one.
like: set today=`/usr/bin/date +%d`
set yesterday=/usr/bin/expr $today - 1

so how can I manipulate the date using date command and subtract a day, week, or moth from the current day.



 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Manipulating two files

Hi Friends, I prefer to represent my problem with example. I have two files as below: file1.txt --------- abcd.....1234......XY abcd.....1235......XX abcd................. abcd...231236..1111YX abcd...241236..1112YY abcd...241237......YY abce.....1235......YY file2.txt ------- ... (4 Replies)
Discussion started by: rinku11
4 Replies

2. Solaris

Manipulating File

Help...please. I have a log that contains Warning Authentication Failed: User GHDT88998HS doesn't exit: The User GHDT88998HS could not be found Mar 22, 2008 5:22:22AM com.hometel.ttm.auth.userlogin. about maybe a thousand entries failed user acct message How can I grab just the username... (2 Replies)
Discussion started by: rivendell500
2 Replies

3. UNIX for Dummies Questions & Answers

string manipulating

I have a file like this: Tue Apr 15 10:41:47 MDT 2008 FINAL RESULT; 6 Tue Apr 15 10:41:47 MDT 2008 FINAL RESULT; 2 Tue Apr 15 10:41:47 MDT 2008 FINAL RESULT; 5 With this command seira=`cut -f 2 -d ';' tes.txt` i take all the results (6,2,5 etc) and i store them in variable seira When i do... (9 Replies)
Discussion started by: psalas
9 Replies

4. Emergency UNIX and Linux Support

Manipulating Data

Hi. I haven't had to write bash scripts in a long time and have a simple task to do, but need some help: Input: chrY:22627291-22651542 chrY:23045932-23070172 chrY:23684890-23696359 chrY:25318610-25330083 chrY:25451096-25462570 chr10:1054847-1061799 chr10:1058606-1080131... (7 Replies)
Discussion started by: awknerd
7 Replies

5. Solaris

Manipulating TOP

I need the command top to output as: Memory: 2048M real, 1499M free, 53M swap in use, 5423M swap free on just the memory line. Instead, I have compiled the new version of top that displays as so: Memory: 2048M phys mem, 1499M free mem, 5476 total swap, 5423M swap free I read... (2 Replies)
Discussion started by: adelsin
2 Replies

6. Shell Programming and Scripting

need help on manipulating a file

Hi, I need a shell/command to achieve this task. I've a delimited unloaded file from oracle in a scrambled format as shown below with many blank lines in it, I'm just trying to tailor it in a format that would be compatible to view and load it to a IDS db. Here is the problem ... (1 Reply)
Discussion started by: divak
1 Replies

7. UNIX for Dummies Questions & Answers

Manipulating files

Hi Guys, I'm really new to Unix and Linux and other scripting languages but recently I hv been really enthusiatic about learning more to help out on my work. So I have a file with 3 columns. A sample of it looks like looks like this : K2_537841 AAATCAGCCGCAACATTTGC ... (7 Replies)
Discussion started by: pawannoel
7 Replies

8. Shell Programming and Scripting

Manipulating Filenames

Hi Folks, I'm looking for some ideas on how to change some file names. I'm pretty sure I need to use sed or awk but they still escape me. The files I have are like: VOD0615 NEW Blades R77307.pdf or VOD0615_NEW_Blades_R77307.pdf and what I want after processing is: R77307 NEW Blades.pdf ... (5 Replies)
Discussion started by: imonkey
5 Replies

9. Shell Programming and Scripting

Manipulating Columns!

Hello Experts, I have .txt file which has various columns and 4 rows. cat input.txt Cont x y z k Max 0.3 0.9 0.4 0.6 Min 0.2 0.9 0.3 0.6 Diff 0.1 0 0.1 0 Output: Cont x y z k Max 0.5 1.1 0.6 0.8 Min 0.1 0.7 0.2 0.4 Diff 0.4 0.4 0.4 0.4 That means if the diff between the Max and... (2 Replies)
Discussion started by: dixits
2 Replies

10. Shell Programming and Scripting

Manipulating files

Not sure if the question posted in another forums can be moved by me.So posting the link here. https://www.unix.com/unix-advanced-expert-users/221425-shell-script-manipulate-files.html#post302795379 Need your help here. (1 Reply)
Discussion started by: vedanta
1 Replies
curl_getdate(3) 						  libcurl Manual						   curl_getdate(3)

NAME
curl_getdate - Convert an date in a ASCII string to number of seconds since January 1, 1970 SYNOPSIS
#include <curl/curl.h> time_t curl_getdate(char *datestring, time_t *now"); DESCRIPTION
This function returns the number of seconds since January 1st 1970, for the date and time that the datestring parameter specifies. The now parameter is there and should hold the current time to allow the datestring to specify relative dates/times. Read further in the date string parser section below. PARSING DATES AND TIMES
A "date" is a string, possibly empty, containing many items separated by whitespace. The whitespace may be omitted when no ambiguity arises. The empty string means the beginning of today (i.e., midnight). Order of the items is immaterial. A date string may contain many flavors of items: calendar date items This can be specified in a number of different ways. Including 1970-09-17, 70-9-17, 70-09-17, 9/17/72, 24 September 1972, 24 Sept 72, 24 Sep 72, Sep 24, 1972, 24-sep-72, 24sep72. The year can also be omitted, for example: 9/17 or "sep 17". time of the day items This string specifies the time on a given day. Syntax supported includes: 18:19:0, 18:19, 6:19pm, 18:19-0500 (for specifying the time zone as well). time zone items Specifies international time zone. There are a few acronyms supported, but in general you should instead use the specific realtive time compared to UTC. Supported formats include: -1200, MST, +0100. day of the week items Specifies a day of the week. If this is mentioned alone it means that day of the week in the future. Days of the week may be spelled out in full: `Sunday', `Monday', etc or they may be abbreviated to their first three letters, optionally followed by a period. The special abbreviations `Tues' for `Tuesday', `Wednes' for `Wednesday' and `Thur' or `Thurs' for `Thursday' are also allowed. A number may precede a day of the week item to move forward supplementary weeks. It is best used in expression like `third mon- day'. In this context, `last DAY' or `next DAY' is also acceptable; they move one week before or after the day that DAY by itself would represent. relative items A relative item adjusts a date (or the current date if none) forward or backward. Example syntax includes: "1 year", "1 year ago", "2 days", "4 weeks". The string `tomorrow' is worth one day in the future (equivalent to `day'), the string `yesterday' is worth one day in the past (equivalent to `day ago'). pure numbers If the decimal number is of the form YYYYMMDD and no other calendar date item appears before it in the date string, then YYYY is read as the year, MM as the month number and DD as the day of the month, for the specified calendar date. RETURN VALUE
This function returns zero when it fails to parse the date string. Otherwise it returns the number of seconds as described. AUTHORS
Originally written by Steven M. Bellovin <smb@research.att.com> while at the University of North Carolina at Chapel Hill. Later tweaked by a couple of people on Usenet. Completely overhauled by Rich $alz <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990. SEE ALSO
BUGS
Surely there are some, you tell me! libcurl 7.0 5 March 2001 curl_getdate(3)
All times are GMT -4. The time now is 09:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy