![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Append to end of each line of file without a temp file. | rorey_breaker | Shell Programming and Scripting | 4 | 04-03-2008 10:11 AM |
| How to append a Value to all the rows in a file | dsshishya | Shell Programming and Scripting | 2 | 03-20-2008 05:04 PM |
| Append (cat) to beginning of file ? | CBZ | Shell Programming and Scripting | 8 | 02-19-2008 01:26 AM |
| append file name contents to a target file | gopskrish | UNIX for Dummies Questions & Answers | 2 | 10-27-2006 06:18 AM |
| Append a field to the end of each line of a file based on searching another file. | ultimate | Shell Programming and Scripting | 2 | 03-29-2005 10:21 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Append output to file
Hi,
I have a script below. It get's the data from the output of a script that is running hourly. My problem is every time my script runs, it deletes the previous data and put the current data. Please see output below. What I would like to do is to have the hourly output to be appended on the file like the expected output below. Please help me how to modify my script to do it. Thanks! Output: DateTime succDeliv failDeliv Subs SysFail Tot 2007-10-24_15H 12 1 43 0 1856 Expected output: DateTime succDeliv failDeliv Subs SysFail Tot 2007-10-24_00H 12 13 43 6 1856 2007-10-24_01H 16 21 80 0 1780 2007-10-24_03H 0 8 56 9 1867 2007-10-24_04H 98 0 67 0 1909 Script: #!/bin/ksh -f ######get date today############ ngayon=`TZ=GMT+1 date '+%Y-%m-%d'` dateF=`TZ=GMT date '+%Y-%m-%d_%HH'` outFayl="RSC-FinalStat-${ngayon}.txt" workDir="/export/Stats" printf "%-20s %-20s %-20s %-20s %-20s %-20s\n" DateTime succDeliv failDeliv Subs SysFail Tot > $workDir/$outFayl cd $workDir DateTime=dateF succDeliv=`sed -n 2p $workDir/Stats_$dateF.txt` failDeliv=`sed -n 4p $workDir/Stats_$dateF.txt` AbsSubs=`sed -n 6p $workDir/Stats_$dateF.txt` SysFail=`sed -n 8p $workDir/Stats_$dateF.txt` Tot=`sed -n 10p $workDir/Stats_$dateF.txt` printf "%-20s %-20s %-20s %-20s %-20s %-20s\n" $dateF $succDeliv $failDeliv $Subs $SysFail $Tot >> $workDir/$outFayl |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|