Sponsored Content
Top Forums Shell Programming and Scripting [Solved] Replace yesterday date with today's date except from the first line Post 302738247 by Lilu_CK on Friday 30th of November 2012 04:23:29 PM
Old 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

Compare date from db2 table to yesterday's Unix system date

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

Yesterday's date without changing anything and in one cmd line ?

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

Shell Scripts - shows today’s date and time in a better format than ‘date’ (Uses positional paramete

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

Need help in Shell Script comparing todays date with Yesterday date from Sysdate

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

Replace date on a line with current date

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

How to get tomorrow,yesterday date from date Command

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

UNIX date fuction - how to deduct days from today's date

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

How to append date to filename, but base it on yesterday's date?

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

Shell script to compare two files of todays date and yesterday's date

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

Compare Date to today's date in shell script

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
ACCOUNTING(1)							      SMPPPD							     ACCOUNTING(1)

NAME
accounting - calculates statistics about your internet connections DESCRIPTION
accounting is a simple program to calculate statistics about your internet dial-up connections that are started and stopped by either ifup and ifdown or by a frontend to smpppd like cinternet , qinternet or kinternet. OPTIONS
These options are recognized by accounting. If a long option shows an argument as mandatory, then it is mandatory for the equivalent short option also. -l, --last=NUM Only consider the last NUM connections. -a, --after=DATE Only consider connections started after DATE. DATE is a date with optional time in ISO 8601 format, e.g. `2002-12-24 20:15:00'. Note that a date without time is treated as if the time is 00:00:00. Hence connections started on the specified date are consid- ered. -b, --before=DATE Only consider connections started before DATE. -u, --user=USER Only consider connections started by user USER. --this-year Only consider connections started this year. --last-year Only consider connections started last year. --this-month Only consider connections started this month. --last-month Only consider connections started last month. --this-week Only consider connections started this week. --last-week Only consider connections started last week. --today Only consider connections started today. --yesterday Only consider connections started yesterday. --per-year Show summaries on a per year basis. --per-month Show summaries on a per month basis. --per-week Show summaries on a per week basis. --per-day Show summaries on a per day basis. -c, --connections Only list the connections but do not show provider statistics. -p, --providers Do not list the connections only show the provider statistics. --connection-format=FORMAT The names of the columns to print in the connection list. The names must be separated by a comma. Known column names are time, type, provider, user, status, duration, rx, tx, rxtx, averx, avetx and averxtx. Each name may be appended by a colon and a number indicating the width for the column, e.g. provider:25. The value will not be truncated if the width is too small. --provider-format=FORMAT The names of the columns to print in the provider list equivalent to the --connection-format option. Known column names are provider, number, duration, rx, tx, rxtx, aveduration, averx, avetx and averxtx. --local Display all dates in local time. Also interpret dates on the command line in local time. This is the default. --utc Display all dates in UTC. Also interpret dates on the command line in UTC. --script[=STYLE] Format output for script. Known styles are c and sh. -f, --file=NAME Use a different file with accounting information. --report-errors Report erros in the accounting file. --version Show program version and exit. --help Show help information and exit. NOTES
All informations are only obtained through the accounting log. Hence the informations, esp. the data volume, of currently active connec- tions is not accurate. If you want the know the status of a connection, use ifstatus or a frontend to smpppd like cinternet , qinternet or kinternet instead. The user field is empty for connections started by a remote frontend of smpppd. BUGS
Not yet implemented for ISDN (ippp). FILES
/var/log/smpppd/accounting.log File containing accounting information. SEE ALSO
kinternet, qinternet, cinternet(1), smpppd(8), smpppd-ifcfg(8). AUTHOR
Arvin Schnell <arvin@suse.de> SuSE December 2002 ACCOUNTING(1)
All times are GMT -4. The time now is 12:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy