The script below works just fine.
Now i want to instead of just printing the last 7 days i want to print all the days last month. So if the script runs now, it will show all the 30 days in november.
I dont want any days to be shown in this month....
Im stuck, dont know how i will gett this to work?
****************************************** ---------- Post updated at 09:55 PM ---------- Previous update was at 09:39 PM ----------
I forgot to mention that /honey/logs/statistics/s* files
looks like this:
And for example the s_201612 looks like inside:
and the script output (mail output) right now something like this:
Last edited by vgersh99; 12-12-2016 at 05:38 PM..
Reason: code tags, please!
Yes, some idea what you expect might help. Howsoever, try
It has two drawbacks:
- the last month name is missing (as the seq separator string is used)
- it needs the (dangerous) eval command.
Still it might be something to start with.
EDIT: Hoppla, reading carefully and completely sometimes helps: seq allows for a floating format specifier. Try
Could you not just have a case statement to define the number of days in each month or perhaps base it on the cal command? You will need a way to work out what last month is from the current date and/or prompt for input.
I must say I'm confused by the output you suggest. I cannot see how you generate it from the input. Are you trying to summarise some figures for each day that are recorded in a mixed up input file from a number of tills/stores/areas? It's difficult to tell.
Can you elaborate a bit more? It might be possible to streamline the process with an awk but you would need to be very specific with the input, calculations and the output required.
This was my first impulse too: why would you fumble around with some date-shenanigans when cal would provide all dates in a given month from the start?
Hello.
System : opensuse leap 42.3
I have a bash script that build a text file.
I would like the last command doing :
print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt
where :
print_cmd ::= some printing... (1 Reply)
Hi,
I have an automated script which have set of sqls but when i am trying to execute the automated script by using nohup command, it is throwing an error like "Input is not UTF-8" .
And when i digged in to it, i am getting some "Â" character in the shell script.
How to avoid this!?
Thanks. (1 Reply)
Hi,
Could anyone please shed some light on the following script lines and what is it doing as it was written by an ex-administrator?
cat $AMS/version|read a b verno d
DBVer=$(/usr/bin/printf "%7s" $verno)
I checked that the cat $AMS/version command returns following output:
... (10 Replies)
Hello All
Nice to meet you all here in this forum,
it's my 1rst time here
i'm asking about a little issue that i face
i added a ksh script that echo " please insert your name " and store the output to a login.log file.
the script is working fine with normal telnet
but Xstart is not working... (8 Replies)
Hi all,
I´ve already searched the forum but can´t find what i am doing wrong.
I am trying to compare two variables using ksh under red hat. The error I get is:
-ksh: .: MDA=`md5sum /tmp/ftp_dir_after_transfer | cut -d' ' -f1 `
MDB=`md5sum /tmp/ftp_dir_before_transfer | cut -d' ' -f1 `... (3 Replies)
Hi,
Using AIX 5.3 and Ksh.
/>ls -al /usr/bin/ksh
-r-xr-xr-x 5 bin bin 237420 Apr 10 2007 /usr/bin/ksh
/>
I recently started working for a new employer. I have written UNIX K-Shell scripts for many years and have never had this particular issue before. Its perplexing me.
I have... (2 Replies)
AIX 4.2
I am trying to do an rsh grep to search for date records inside server logs by doing this :
xx=`date +"%a %b %d"`
rsh xxx grep "^$XX" zzz
gives :
grep: 0652-033 Cannot open Jun.
grep: 0652-033 Cannot open 11.
But if I do :
xx=`date +"%a %b %d"`
grep "^$XX" zzz
it works... (2 Replies)
Hi,
I have small script written in korn shell. When it is called from different script, its dumping core, but no core dump when we run it standalone.
And its not dumping core if we run the script using "/bin/sh" instead of "ksh"
Can some body please help me how to resolve this issue.
... (9 Replies)
Hey all,
I have a shell that invokes a AWK.
In this AWK i want invoke a function that receives 3 parameters:
date: 20080831
time: 235901
duration: 00023
that function receive this 3 parameters and sum to this value two more seconds:
2008083123590100025
Remember that in case that... (3 Replies)
I have created a ksh shell script and used it as a login shell for a user.
</etc/passwd>
lramirev:x:111:200:Luis:/export/home/menush:/usr/local/menush/menush
My shell script is like this:
</usr/local/menush/menush>
#!/bin/ksh
#
if ]
then
. $HOME/.profile
fi
... (8 Replies)