Sponsored Content
Top Forums Shell Programming and Scripting Add current date to the data file Post 302725311 by LucyYani on Friday 2nd of November 2012 08:20:54 AM
Old 11-02-2012
im using nawk..its not workin..

---------- Post updated at 02:20 PM ---------- Previous update was at 10:53 AM ----------

I want this:
0.0230769,0.407692,0.307692,0,0.1,1.4,1,0,ADD DATE HERE,

im getting this:
11/02/12
0.00192308,0.0269231,0.0192308,0,0.1,1.4,1,0,

my script:
Code:
#!/bin/ksh

DIR=/export/home/yani_m/scripts/scrip_out_put/
DIR2=/export/home/yani_m/scripts/scrip_out_put/calc/
Date=$1
File22="disk_"$Date
Server=$2
iofiles=$DIR"/*"$Date"*_Ynr.dat"
gzipedfile=$File22".gz"

#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 "," 'BEGIN {Date=system("date +%D")}{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>=m
axr {maxr = $1} $2>=maxw {maxw = $2}$3>=maxwe {maxwe = $3}$4>=maxb {maxb = $4}
END{print sumr/NR "," sumw/NR ","  busy/NR "," wait/NR "," maxr "," maxw "," maxb "," maxwe ","}'>>/export/home/yani_m/scripts/FILE_TO_LOAD.dat
gzip $DIR2/$File22


please help guys

Last edited by Franklin52; 11-02-2012 at 10:03 AM.. Reason: Code tags
 

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
drv_usecwait(9F)					   Kernel Functions for Drivers 					  drv_usecwait(9F)

NAME
drv_usecwait - busy-wait for specified interval SYNOPSIS
#include <sys/types.h> #include <sys/ddi.h> void drv_usecwait(clock_t microsecs); INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI). PARAMETERS
microsecs The number of microseconds to busy-wait. DESCRIPTION
drv_usecwait() gives drivers a means of busy-waiting for a specified microsecond count. The amount of time spent busy-waiting may be greater than the microsecond count but will minimally be the number of microseconds specified. delay(9F) can be used by a driver to delay for a specified number of system ticks, but it has two limitations. First, the granularity of the wait time is limited to one clock tick, which may be more time than is needed for the delay. Second, delay(9F) may only be invoked from user context and hence cannot be used at interrupt time or system initialization. Often, drivers need to delay for only a few microseconds, waiting for a write to a device register to be picked up by the device. In this case, even in user context, delay(9F) produces too long a wait period. CONTEXT
drv_usecwait() can be called from user or interrupt context. SEE ALSO
delay(9F), timeout(9F), untimeout(9F) Writing Device Drivers NOTES
The driver wastes processor time by making this call since drv_usecwait() does not block but simply busy-waits. The driver should only make calls to drv_usecwait() as needed, and only for as much time as needed. drv_usecwait() does not mask out interrupts. SunOS 5.10 12 Nov 1992 drv_usecwait(9F)
All times are GMT -4. The time now is 09:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy