Listing out sundays alone


 
Thread Tools Search this Thread
# 8  
Quote:
Originally Posted by methyl
Just lose the switch completely.
Whoops, thanks... I may have that weird disorder that makes me want to use switches all the time. Smilie
# 9  
Finally got the result as comma separated:
Code:
cal 12 2011|awk '/^[0-9]/||/^[ ][0-9]/{ORS=",";print $1}'|sed 's/.$//'
4,11,18,25

Thanks all!
# 10  
try..

code: cal 12 2011 | cut -c1-3 | awk '/[[:digit:]]/{print $1}'
# 11  
Quote:
Originally Posted by tarun_agrawal
try..

code: cal 12 2011 | cut -c1-3 | awk '/[[:digit:]]/{print $1}'
Please use code tags,else you will get warning from moderators.

---------- Post updated at 08:36 AM ---------- Previous update was at 08:28 AM ----------

Quote:
Originally Posted by tarun_agrawal
try..

code: cal 12 2011 | cut -c1-3 | awk '/[[:digit:]]/{print $1}'
And also it returns nothing
Code:
pandeeswaran@ubuntu:~$ cal 12 2011 | cut -c1-3 | awk '/[[:digit:]]/{print $1}'
pandeeswaran@ubuntu:~$

---------- Post updated at 08:45 AM ---------- Previous update was at 08:36 AM ----------

I am also wondering why the below command not returns any result:
Code:
pandeeswaran@ubuntu:~$ cal 12 2011|cut -c1-2|awk '/^[[:digit:]]/{print $1}'

# 12  
Code:
cal 12 2011 | nawk 'NR==3 && NF ==7 {a=$1","} NR>3 {a=a","$1}END{gsub("^,|,$","",a);print a}'

# 13  
Quote:
Originally Posted by itkamaraj
Code:
cal 12 2011 | nawk 'NR==3 && NF ==7 {a=$1","} NR>3 {a=a","$1}END{gsub("^,|,$","",a);print a}'

May i know
Code:
[:digit:]

is not working properly?
# 14  
try with gawk
 

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Add previous Sundays date to filename

I am looking for some scripting help. I need to add a time stamp to a file name. I will append data to a file, and want to add to the file name a time stamp of the previous Sundays date. Any takers? (1 Reply)
Discussion started by: sswagner8839
1 Replies

2. UNIX for Dummies Questions & Answers

[Solved] How to remove listing of current user cmd from ps -ef listing?

Hi All, Could you please help to resolve my following issues: Problem Description: Suppose my user name is "MI90". i.e. $USER = MI90 when i run below command, i get all the processes running on the system containing name MQ. ps -ef | grep MQ But sometimes it lists... (8 Replies)
Discussion started by: KDMishra
8 Replies

3. Shell Programming and Scripting

Taking the count of sundays between two date ?

Hi Am using unix Ksh Datecalc and --date functions are not working have two input variables as DATE=01/12/2012 DATE1=23/12/2012 Need output as no of sundays = 4 Can anyone help me pls :( (2 Replies)
Discussion started by: Venkatesh1
2 Replies

4. UNIX for Advanced & Expert Users

How to take the count of all sundays between two dates?

Hi Am Using Unix Ksh I have input DATE1=01/11/2012 DATE2=10/12/2012 need output as count of all sundays between these two dates for examples Sunday count between DATE1 and DATE2 is 5 Can anyone help me... (11 Replies)
Discussion started by: Venkatesh1
11 Replies

5. UNIX Desktop Questions & Answers

count of sundays in month

Hi, How to get count of number of sundays in month in unix shell script .. ideally i need 2 get last sunday of month so i used cmd: for eg: for june: cal 06 2011 | tail -2 | head -1 | cut -d" " -f1 hoowever above is wrking for month whose sundays are max=4 but not fr months... (4 Replies)
Discussion started by: musu
4 Replies

6. UNIX for Dummies Questions & Answers

listing files

how would i list all files that began witha "t" and have any number of characters after the "t"? (2 Replies)
Discussion started by: trob
2 Replies

7. UNIX for Dummies Questions & Answers

Listing files

how would i list all files, directories and exectable files in my directory? is there anyway to find out what date a file was created? Thanks!! (2 Replies)
Discussion started by: trob
2 Replies

8. Shell Programming and Scripting

Cronjob on alternate sundays

I want to set the crontab job for one of my SIEBEL database to refresh it on alternate sundays. Is there anyway I can do it through cron please ? If not whats the alternative ? :confused: Thanks in advance. (6 Replies)
Discussion started by: abhi123
6 Replies

9. Shell Programming and Scripting

List of Sundays for the years 2000 to 2005

hi, i need to write a script that would list me all sundays in the year 2000 and 2005. output need to be just the date . ;) (1 Reply)
Discussion started by: kquest
1 Replies

10. UNIX for Dummies Questions & Answers

Recursive directory listing without listing files

Does any one know how to get a recursive directory listing in long format (showing owner, group, permission etc) without listing the files contained in the directories. The following command also shows the files but I only want to see the directories. ls -lrtR * (4 Replies)
Discussion started by: psingh
4 Replies

Featured Tech Videos