Sponsored Content
Full Discussion: Last friday of every month
Top Forums Shell Programming and Scripting Last friday of every month Post 302211804 by vbe on Friday 4th of July 2008 12:27:14 PM
Old 07-04-2008
Using what you can find in this forum:
https://www.unix.com/shell-programmin...h-month-2.html

(My box is an HP hpux11.11)
ant:/home/vbe/wks $ cal_use
ENTER Month Year format mm yyyy 06 2008
CALDATE : 06 2008
Last Friday is 27
ant:/home/vbe/wks $ cal_use
ENTER Month Year format mm yyyy 07 2008
CALDATE : 07 2008
Last Friday is 25
ant:/home/vbe/wks $ cal_use
ENTER Month Year format mm yyyy 02 2008
CALDATE : 02 2008
Last Friday is 29
ant:/home/vbe/wks $


ant:/home/vbe/wks $ more cal_use
#!/usr/bin/ksh

echo " ENTER Month Year format mm yyyy \c "
read CALDATE
echo " CALDATE : " $CALDATE

FRI=$(cal $CALDATE | tail +3 | cut -c16,17 | sed '/^ *$/d' | sed -n '5p')
# or FRI=$(cal $CALDATE | tail +3 | cut -c21,22 | sed '/^ *$/d' | sed -n '5p') under AIX...
if [ "$FRI" -eq "" ]
then
FRI=$(cal $CALDATE | tail +3 | cut -c16,17 | sed '/^ *$/d' | sed -n '4p')
#FRI=$(cal $CALDATE | tail +3 | cut -c21,22 | sed '/^ *$/d' | sed -n '4p') for AIX...
fi
echo "Last Friday is " $FRI

#cal_use: END

All the best

Last edited by vbe; 07-05-2008 at 07:59 AM.. Reason: add empty line for reading convenience
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need help, Every friday in a month

I am trying to write a script that shows every Friday in a month. I used cal $1 $2 | grep -v "^$" | awk '{print $6}' It doesn't work for the frist week of Friday because calendar command output has some spaces in the first line and awk '{print $6}' doesn't work. Anybody help me with this... (3 Replies)
Discussion started by: LAY
3 Replies

2. Shell Programming and Scripting

how can i find the third friday of each month?

Help please! I need to read the calendar and put the date of the third Friday of each month into a variable for comparison in an "if" statement. How would I do this? Thnx, leslie02 (10 Replies)
Discussion started by: leslie02
10 Replies

3. UNIX for Dummies Questions & Answers

print previous month (current month minus 1) with Solaris date and ksh

Hi folks month=`date +%m`gives current month Howto print previous month (current month minus 1) with Solaris date and ksh (7 Replies)
Discussion started by: slashdotweenie
7 Replies

4. Shell Programming and Scripting

Script to counting a specific word in a logfile on each day of this month, last month etc

Hello All, I am trying to come up with a shell script to count a specific word in a logfile on each day of this month, last month and the month before. I need to produce this report and email it to customer. Any ideas would be appreciated! (5 Replies)
Discussion started by: pnara2
5 Replies

5. Shell Programming and Scripting

cron job to run on second to last friday each month

I needed a cron job to run on the second to last friday of every month. Our servers are running HP-UX, and the HP-UX date command is pretty basic and does not have all of the fancy options that Linux date command does, and it does not have the ability at all to return future dates. So I had to... (0 Replies)
Discussion started by: lupin..the..3rd
0 Replies

6. UNIX for Dummies Questions & Answers

[Solved] Cron - job to run every 3rd Friday of the month only

Hi Expert Please help me to set a cron job schedule, Ihave a job that run every 3rd Friday of the month at 1030am. I tried to set up like this, but the job still runs every friday at 1030am. I want the job to run every 3rd Friday of the month at 1030am only 30 10 15,16,17,18,19,20,21... (2 Replies)
Discussion started by: kaibiganmi
2 Replies

7. Red Hat

How to find/display out last Friday's date of the month?

Hello, Can you please help me find/display out last Friday's date of the month using command in Unix/Linux (3 Replies)
Discussion started by: sunnysthakur
3 Replies

8. Shell Programming and Scripting

How to add decimal month to some month in sql, php, perl, bash, sh?

Hello, i`m looking for some way to add to some date an partial number of months, for example to 2015y 02m 27d + 2,54m i need to write this script in php or bash or sh or mysql or perl in normal time o unix time i`m asking or there are any simple way to add partial number of month to some... (14 Replies)
Discussion started by: bacarrdy
14 Replies

9. Shell Programming and Scripting

Need last month files after 10th of every month

Hi, I need all file names in a folder which has date >= 10th of last month, Example : files in folder AUTO_F1_20140610.TXT BUTO_F1_20140616.TXT CUTO_F1_20140603.TXT FA_AUTO_06012014.TXT LA_AUTO_06112014.TXT MA_AUTO_06212014.TXT ZA_AUTO_06232014.TXT Output: AUTO_F1_20140610.TXT... (9 Replies)
Discussion started by: nani1984
9 Replies

10. Linux

Bash Display First Friday of the next month

Hello, I need to find the date of next first Friday of the month and set as a variable in a bash script ie - FIRSTFRIDAY=$(date -dfirst-friday +%d) I know date -dfirst-friday doesn't work, but unsure if I can use this / cal + awk or something else to find the right date of the... (7 Replies)
Discussion started by: summerdays
7 Replies
PDF::API2::Annotation(3pm)				User Contributed Perl Documentation				PDF::API2::Annotation(3pm)

NAME
PDF::API2::Annotation - annotation management METHODS
$ant = PDF::API2::Annotation->new Returns a annotation object (called from $page->annotation). $ant->link $page, %opts Defines the annotation as launch-page with page $page and options %opts (-rect, -border or 'dest-options'). $ant->url $url, %opts Defines the annotation as launch-url with url $url and options %opts (-rect and/or -border). $ant->file $file, %opts Defines the annotation as launch-file with filepath $file and options %opts (-rect and/or -border). $ant->pdfile $pdfile, $pagenum, %opts Defines the annotation as pdf-file with filepath $pdfile, $pagenum and options %opts (same as dest). $ant->text $text, %opts Defines the annotation as textnote with content $text and options %opts (-rect and/or -open). $ant->movie $file, $contentype, %opts Defines the annotation as a movie from $file with $contentype and options %opts (-rect). $ant->rect $llx, $lly, $urx, $ury Sets the rectangle of the annotation. $ant->border @b Sets the border-styles of the annotation, if applicable. $ant->content @lines Sets the text-content of the annotation, if applicable. $ant->open $bool Display the annotation either open or closed, if applicable. $ant->dest( $page, -fit => 1 ) Display the page designated by page, with its contents magnified just enough to fit the entire page within the window both horizontally and vertically. If the required horizontal and vertical magnification factors are different, use the smaller of the two, centering the page within the window in the other dimension. $ant->dest( $page, -fith => $top ) Display the page designated by page, with the vertical coordinate top positioned at the top edge of the window and the contents of the page magnified just enough to fit the entire width of the page within the window. $ant->dest( $page, -fitv => $left ) Display the page designated by page, with the horizontal coordinate left positioned at the left edge of the window and the contents of the page magnified just enough to fit the entire height of the page within the window. $ant->dest( $page, -fitr => [ $left, $bottom, $right, $top ] ) Display the page designated by page, with its contents magnified just enough to fit the rectangle specified by the coordinates left, bottom, right, and top entirely within the window both horizontally and vertically. If the required horizontal and vertical magnification factors are different, use the smaller of the two, centering the rectangle within the window in the other dimension. $ant->dest( $page, -fitb => 1 ) (PDF 1.1) Display the page designated by page, with its contents magnified just enough to fit its bounding box entirely within the window both horizontally and vertically. If the required horizontal and vertical magnification factors are different, use the smaller of the two, centering the bounding box within the window in the other dimension. $ant->dest( $page, -fitbh => $top ) (PDF 1.1) Display the page designated by page, with the vertical coordinate top positioned at the top edge of the window and the contents of the page magnified just enough to fit the entire width of its bounding box within the window. $ant->dest( $page, -fitbv => $left ) (PDF 1.1) Display the page designated by page, with the horizontal coordinate left positioned at the left edge of the window and the contents of the page magnified just enough to fit the entire height of its bounding box within the window. $ant->dest( $page, -xyz => [ $left, $top, $zoom ] ) Display the page designated by page, with the coordinates (left, top) positioned at the top-left corner of the window and the contents of the page magnified by the factor zoom. A zero(0) value for any of the parameters left, top, or zoom specifies that the current value of that parameter is to be retained unchanged. $ant->dest( $name ) (PDF 1.2) Connect the Annotation to a "Named Destination" defined elswere. AUTHOR
Alfred Reibenschuh perl v5.14.2 2014-03-09 PDF::API2::Annotation(3pm)
All times are GMT -4. The time now is 06:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy