![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| work with date function | jasonx22 | Web Programming, Web 2.0 and Mashups | 1 | 07-19-2008 09:12 AM |
| Date Function | charandevu | Shell Programming and Scripting | 1 | 04-02-2008 06:12 AM |
| Date Function | charandevu | Shell Programming and Scripting | 1 | 04-02-2008 04:44 AM |
| date function | abey | Shell Programming and Scripting | 2 | 02-27-2006 02:28 AM |
| Yesterday's date function | ssmiths001 | UNIX for Dummies Questions & Answers | 4 | 01-11-2005 07:06 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Get date from cal function
Cal
Sun Mon Tue Wed Thu Fri Sat 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 cal | awk '{print $7}' Sat 13 20 27 In the above output i am missing 6 because the first column is empty so it is shfting. How can i print all the dates under sat. I need the output like below. Sat 6 13 20 27 |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Use cut to cut out the column by character count.
|
|
#3
|
||||
|
||||
|
Use nawk or /usr/xpg4/bin/awk on Solaris:
Code:
cal|awk '{print/^ /?$NF:$7}'
|
|
#4
|
|||
|
|||
|
A very ugly way to do this...But the solution suggested by radoulov must be the best way..
Code:
cal | sed -n '/\(.*\) \(.*\) \(.*\) \(.*\) \(.*\) \(.*\) \(.*\)/p' |sed 's/\(.*\) \(.*\)/\2/' |
|||
| Google The UNIX and Linux Forums |