![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| doubt in tr command | risshanth | UNIX for Dummies Questions & Answers | 2 | 02-25-2008 07:20 AM |
| Doubt in SED command | gksenthilkumar | UNIX for Advanced & Expert Users | 1 | 02-19-2008 11:20 AM |
| doubt in AWK | abnirmal | Shell Programming and Scripting | 4 | 05-08-2007 02:27 PM |
| Pls help for the doubt | ravi.sadani19 | Shell Programming and Scripting | 4 | 04-12-2007 01:51 AM |
| Doubt in find command | mona | Shell Programming and Scripting | 3 | 12-11-2005 09:54 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
doubt in cal command
I am new to unix...
How to get all the saturdays of a specific year? for a specific month, i tried as below.. cal 02 2006 | awk '{print $7}' but it is not giving all saturdays.... can anyone help me with this? Thanks in advance, Sumi |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Hi
Try the following command cal 01 2006 | tr -s " " | sed -e '1,2d' | awk -F" " '{print $1}' use the following in awk $1 - For Sundays $2 - For Mondays $3 - For Tuesdays and so on Hope this helps Regards Bobby |
|
#3
|
|||
|
|||
|
i tried the command u sent...for this command,
cal 02 2006 | tr -s " " | sed -e '1,2d' | awk -F" " '{print $7}' output should be: 4 11 18 25 but the output i am getting for the above command: 11 18 25 |
|
#4
|
||||
|
||||
|
Read the date arithmetic article in our faq section. My datecalc script can do stuff like this:
Code:
#! /usr/bin/ksh
desiredday=$1
year=$2
(( cday = $(datecalc -j $year 1 1) + (($desiredday - $(datecalc -d $year 1 1) + 7)%7) ))
(( limit = $(datecalc -j $year 12 31) ))
while ((cday<limit)) ; do
datecalc -j $cday
((cday=cday+7))
done
exit 0
./script 6 2006 will give you all saturdays for the current year. |
|
#5
|
|||
|
|||
|
i am using datecalc function....after subtracting 6 from dt1, i am getting
2006 1 15 dt1=2006 01 27 datecalc -a $dt1 - 6 but i want the output as 2006 01 15 i searched the forum... if i get the "day" individually and perform operation, i can use typedef. but i am using the full date and subtracting 6 from it. how to get the desired output as above? |
|
#6
|
||||
|
||||
|
typeset -Z2 month day
datecalc -a $dt1 - 6 | read year month day echo $year $month $day |
|
#7
|
|||
|
|||
|
I have one text file which has many date fields.
Date field is in "mm/dd/yyyy" format. I want to replace every yyyy to yy format. If i have one year value namely 2005, i can replace as s/2005/05/g Since i have many values, how to generalise the the above replacement ? Through script, i need to grep and replace. Thanks in advance. |
|||
| Google The UNIX and Linux Forums |