11-30-2012
[Solved] Replace yesterday date with today's date except from the first line
Hello,
I have a file like this:
2012112920121130
12345620121130msABowwiqiq
34477420121129amABamauee
e7748420121130ehABeheheei
in case the content of the file has the date of yesterday within the lines containing pattern AB this should be replaced by the current date. But if I use "sed", it will replace all the occurrences and I want to leave the first line as it is.
How can I do that?
Any help is really appreciated.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am currently running the following Korn shell script which works fine:
#!/usr/bin/ksh
count=`db2 -x "select count(*) from schema.tablename"`
echo "count"
I would like to add a "where" clause to the 2nd line that would allow me to get a record count of all the records from schema.tablename... (9 Replies)
Discussion started by: sasaliasim
9 Replies
2. AIX
I have seen references in the forum about getting yesterday's date but it is either by changing something in the system (date, time zone, ...) or with more then one line of script cmds.
How can I get yesterday's date without changing anything in the system and in one single command line ? (4 Replies)
Discussion started by: Browser_ice
4 Replies
3. UNIX for Dummies Questions & Answers
Hello,
I am trying to show today's date and time in a better format than ‘date' (Using positional parameters). I found a command mktime and am wondering if this is the best command to use or will this also show me the time elapse since 1/30/70? Any help would be greatly appreciated, Thanks... (3 Replies)
Discussion started by: citizencro
3 Replies
4. Shell Programming and Scripting
Hi,
I want to compare today's date(DDMMYYYY) with yesterday(DDMMYYYY) from system date,if (today month = yesterday month) then execute alter query else do nothing.
The above requirement i want in Shell script(KSH)...
Can any one please help me?
Double post, continued here. (0 Replies)
Discussion started by: kumarmsk1331
0 Replies
5. Shell Programming and Scripting
Hi Guys,
I have a file with following content
From 20121014 : To 20121014
Number of days : 1
1234
1245
1246
1111
Everyday i run my script i want to modify "To" date on the first line with current date. I have set the current date in script as
RUN_DATE=`date -u +%Y%m%d`
So i want... (9 Replies)
Discussion started by: jakSun8
9 Replies
6. Shell Programming and Scripting
Hi
I want to get tomorrow and yesterday date from date command. My shell is KSH and server is AIX. I tried several options, but unable to do. Please help on this.
Regards
Rajesh (5 Replies)
Discussion started by: rajeshmepco
5 Replies
7. Shell Programming and Scripting
Hi,
One of my Unix scripts needs to look for files coming in on Fridays. This script runs on Mondays. $date +"%y%m%d" will give me today's date. How can I get previous Friday's date.. can I do "today's date minus 3 days" to get Friday's date? If not, then any other way?? Name of the files is... (4 Replies)
Discussion started by: juzz4fun
4 Replies
8. Shell Programming and Scripting
Hello,
I'd like to write a monthly archive script that archives some logs. But I'd like to do it based on yesterday's date. In other words, I'd like to schedule the script to run on the 1st day of each month, but have the archive filename include the previous month instead.
Here's what I... (5 Replies)
Discussion started by: nbsparks
5 Replies
9. Shell Programming and Scripting
hi all,
How to compare two files whether they are same are not...? like i had my input files as 20141201_file.txt and 20141130_file2.txt
how to compare the above files based on date .. like todays file and yesterdays file...? (4 Replies)
Discussion started by: hemanthsaikumar
4 Replies
10. UNIX for Beginners Questions & Answers
Hi Community!
Following on from this code in another thread:
#!/bin/bash
file_string=`/bin/cat date.txt | /usr/bin/awk '{print $5,$4,$7,$6,$8}'`
file_date=`/bin/date -d "$file_string"`
file_epoch=`/bin/date -d "$file_string" +%s`
now_epoch=`/bin/date +%s`
if
then
#let... (2 Replies)
Discussion started by: Greenage
2 Replies
LEARN ABOUT DEBIAN
git-replace
GIT-REPLACE(1) Git Manual GIT-REPLACE(1)
NAME
git-replace - Create, list, delete refs to replace objects
SYNOPSIS
git replace [-f] <object> <replacement>
git replace -d <object>...
git replace -l [<pattern>]
DESCRIPTION
Adds a replace reference in .git/refs/replace/
The name of the replace reference is the SHA1 of the object that is replaced. The content of the replace reference is the SHA1 of the
replacement object.
Unless -f is given, the replace reference must not yet exist in .git/refs/replace/ directory.
Replacement references will be used by default by all git commands except those doing reachability traversal (prune, pack transfer and
fsck).
It is possible to disable use of replacement references for any command using the --no-replace-objects option just after git.
For example if commit foo has been replaced by commit bar:
$ git --no-replace-objects cat-file commit foo
shows information about commit foo, while:
$ git cat-file commit foo
shows information about commit bar.
The GIT_NO_REPLACE_OBJECTS environment variable can be set to achieve the same effect as the --no-replace-objects option.
OPTIONS
-f
If an existing replace ref for the same object exists, it will be overwritten (instead of failing).
-d
Delete existing replace refs for the given objects.
-l <pattern>
List replace refs for objects that match the given pattern (or all if no pattern is given). Typing "git replace" without arguments,
also lists all replace refs.
BUGS
Comparing blobs or trees that have been replaced with those that replace them will not work properly. And using git reset --hard to go back
to a replaced commit will move the branch to the replacement commit instead of the replaced commit.
There may be other problems when using git rev-list related to pending objects. And of course things may break if an object of one type is
replaced by an object of another type (for example a blob replaced by a commit).
SEE ALSO
git-tag(1) git-branch(1) git(1)
GIT
Part of the git(1) suite
Git 1.7.10.4 11/24/2012 GIT-REPLACE(1)