Sponsored Content
Top Forums Shell Programming and Scripting Add current date to the data file Post 302725305 by Subbeh on Friday 2nd of November 2012 04:39:12 AM
Old 11-02-2012
If you give the date as the first parameter to the script you can parse it to awk:

Code:
#SERVER2C       : ./test.ksh 20120716 NLEMM02
grep  c[0-9]t[0-9]d[0-9] $iofiles >> $DIR2/$File22
grep $Server $DIR2/$File22 |cut -d : -f 2 |cut -d , -f 1,2,9,10 | nawk -F "," -v date=$1 'BEGIN {sumr=0;sumw=0;busy=0;wait=0} {sumr=sumr+$1}{sumw=sumw+$2}{wait=wait+$3}{busy=busy+$4} {maxr=$1 ; maxw=$2;maxb=$4 ;maxwe=$3} $1>=maxr {maxr = $1} $2>=ma
xw {maxw = $2} $3>=maxwe {maxwe = $3} $4>=maxb {maxb = $4} END {print sumr/NR "," sumw/NR ","  busy/NR "," wait/NR "," maxr "," maxw "," maxb "," maxwe "," date}'>>/export/home/yani_m/scripts/FILE_TO_LOAD.dat
gzip $DIR2/$File22

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl: Extracting date from file name and comparing with current date

I need to extract the date part from the file name (20080221 in this ex) and compare it with the current date and delete it, if it is a past date. $file = exp_ABCD4_T-2584780_upto_20080221.dmp.Z really appreciate any help. thanks mkneni (4 Replies)
Discussion started by: MKNENI
4 Replies

2. Shell Programming and Scripting

how to create file.txt and add current date in file content

Hey guy, how to make bash script to create foo.txt file and add current date into file content and that file always append. example: today the script run and add today date into content foo.txt and tomorrow the script will run and add tomorrow date in content foo.txt without remove today... (3 Replies)
Discussion started by: chenboly
3 Replies

3. Shell Programming and Scripting

how to add current date to the file with sed

I want to add current date into the begin of the first line of the file. please show me the way please with "date" commond and sed (4 Replies)
Discussion started by: yanglei_fage
4 Replies

4. Shell Programming and Scripting

How to extract log data based on current date and month ?

Hi Gurus, I'm using HP-UX B.11.23 operating system. I've been trying to extract this log info based on the current date and month, but was having some issues as the date column which on the 4th column has a comma and the 5th column has a dot tied to it. Here is the output from my shut... (5 Replies)
Discussion started by: superHonda123
5 Replies

5. UNIX for Dummies Questions & Answers

Delete a row from a file if one column containing a date is greater than the current system date

Hello gurus, I am hoping someone can help me with the required code/script to make this work. I have the following file with records starting at line 4: NETW~US60~000000000013220694~002~~IT~USD~2.24~20110201~99991231~01~01~20101104~... (4 Replies)
Discussion started by: chumsky
4 Replies

6. UNIX for Dummies Questions & Answers

Unable to add date to current date.

Hi, I am trying to display future date from the current date but unable to do so in UNIX (not in PERL). For eg: if today is March 5 then I want a variable wherein I can store Mar 7 date, but unable to get the future date from the current date. I have tried many possible ways as mentioned below... (11 Replies)
Discussion started by: amit.mathur08
11 Replies

7. Shell Programming and Scripting

[Solved] How to tar data along with current system date and time.?

Hi all, Following is my small script:- #!/bin/ksh for i in `cat /users/jack/mainfile-dr.txt` do sudo cp -r $i /users/jack/DR01/. done cd /users/jack/DR01/ sudo tar cvf system1-DR.tar * scp system1-DR.tar backupserver:/DRFiles/system1 sudo rm -rf system1-DR.tar In this script I... (10 Replies)
Discussion started by: manalisharmabe
10 Replies

8. Shell Programming and Scripting

Add current date and time

i have file 1.txt asdas|csada|13|03|10|04|23|A1|canberra sdasd|sfdsf|13|04|26|23|28|A1|sydney i want to add today's date and time in the end of each row expected output asdas|csada|13|03|10|04|23|A1|canberra|130430|1358 sdasd|sfdsf|13|04|26|23|28|A1|sydney|130430|1358 todays date... (10 Replies)
Discussion started by: radius
10 Replies

9. Shell Programming and Scripting

Subtract a file's modification date with current date

SunOS -s 5.10 Generic_147440-04 sun4u sparc SUNW,SPARC-Enterprise Hi, In a folder, there are files. I have a script which reads the current date and subtract the modification date of each file. How do I achieve this? Regards, Joe (2 Replies)
Discussion started by: roshanbi
2 Replies

10. UNIX for Beginners Questions & Answers

“sed” replace date in text file with current date

We want to call a parameter file (.txt) where my application read dynamic values when the job is triggered, one of such values are below: abc.txt ------------------ Code: line1 line2 line3 $$EDWS_DATE_INSERT=08-27-2019 line4 $$EDWS_PREV_DATE_INSERT=08-26-2019 I am trying to write a... (3 Replies)
Discussion started by: pradeepp
3 Replies
Net::Google::Code::Issue::Comment(3pm)			User Contributed Perl Documentation		    Net::Google::Code::Issue::Comment(3pm)

NAME
Net::Google::Code::Issue::Comment - Issue's Comment DESCRIPTION
ATTRIBUTES
project project name email, password user's email and password issue_id sequence sequence number, initial comment( when you create an issue ) has sequence 0 date content author updates HashRef that reflects updates attachments INTERFACE
parse( HTML::Element or html segment string ) parse format like the following: <td class="vt issuecomment"> <span class="author">Comment <a name="c18" href="#c18">18</a> by <a href="/u/jsykari/">jsykari</a></span>, <span class="date" title="Wed Sep 3 04:44:39 2008">Sep 03, 2008</span> <pre> <b>haha</b> </pre> <div class="attachments"> <table cellspacing="0" cellpadding="2" border="0"> <tr><td rowspan="2" width="24"><a href="http://chromium.googlecode.com/issues/attachment?aid=-1323983749556004507&amp;name=proxy_settings.png" target="new"><img width="16" height="16" src="/hosting/images/generic.gif" border="0" ></a></td> <td><b>proxy_settings.png</b></td></tr> <tr><td>14.3 KB <a href="http://chromium.googlecode.com/issues/attachment?aid=-1323983749556004507&amp;name=proxy_settings.png">Download</a></td></tr> </table> </div> <div class="updates"> <div class="round4"></div> <div class="round2"></div> <div class="round1"></div> <div class="box-inner"> <b>Cc:</b> thatan...@google.com<br><b>Status:</b> Available<br><b>Labels:</b> Mstone-X<br> </div> <div class="round1"></div> <div class="round2"></div> <div class="round4"></div> </div> </td> list google's api way to get list of comments return a list of loaded( no scraping is done here ) comments in list context, a ref to the list otherwise. parse_hybrid when $Net::Google::Code::Issue::USE_HYBRID is true, we will try to load comments with the google's official api, but as the api is not complete, we still need to do scraping to load something( e.g. attachments ), this method is used to do this. AUTHOR
sunnavy "<sunnavy@bestpractical.com>" LICENCE AND COPYRIGHT
Copyright 2008-2010 Best Practical Solutions. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2010-04-07 Net::Google::Code::Issue::Comment(3pm)
All times are GMT -4. The time now is 03:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy