Sponsored Content
Full Discussion: Awk/sed to play on calender
Top Forums UNIX for Dummies Questions & Answers Awk/sed to play on calender Post 302748091 by pamu on Monday 24th of December 2012 08:57:06 AM
Old 12-24-2012
Try sth like this...

Code:
value=1

cal 10 1987 | awk -v var="$value" 'NR==2{n=split($0,P)}
NR>2{for(i=1;i<=7;i++){if(var == $i){print P[7-NF+i]}}}'

This User Gave Thanks to pamu For This Post:
 

10 More Discussions You Might Find Interesting

1. Programming

C Calender Help - Unusual error

I'm making a program that you input the month and year, and it creates a calender for that month of that year. This is my largest project yet, and I broke it up into several source files. cal.c #include "cal.h" #include <stdio.h> main() { int month, year; scanf("%d %d", &month,... (3 Replies)
Discussion started by: Octal
3 Replies

2. Shell Programming and Scripting

convert Julian date to calender date

Hi, I have script in unix which creates a julian date like 126 or 127 I want convert this julian date into calender date ex : input 127 output 07/may/2007 or 07/05/2007 or 07/05/07 rgds srikanth (6 Replies)
Discussion started by: srikanthus2002
6 Replies

3. Shell Programming and Scripting

Calender Unix programming date issues

Hi, i;m beginner of Unix, i trying to use crontab to zip my log file automatically, below is my coding, some of the statement i don't know whether is correct or not. Pls help:) year=`date '+%Y'` month=`date '+%m'` day=`date '+%d'` day=`expr $day - 1` case $month in 1 | 3 | 5 | 7 | 8 | 9 |... (4 Replies)
Discussion started by: dannyd_y
4 Replies

4. Fedora

Script to find out first day of our calender

I try to find the first day of our calender. So I used this script ... echo -n "The week of the date 01jan0001 : " echo -n `date -d 00010101 +%A` echo But its shows error bash-3.1$ sh first_day.shThe week of the date 01jan0001 : date: invalid date `00010101' (3 Replies)
Discussion started by: krishnampkkm
3 Replies

5. Shell Programming and Scripting

Question on Autosys calender date.

Hi I am trying to schedule a job through Autosys through UNIX on a particular day of every month (for example 20th of every month). Can some one please help me whats the command or whats the process to run on that particular day of month. Thank you, (2 Replies)
Discussion started by: sravuri
2 Replies

6. Shell Programming and Scripting

Awk with Find and play using Space

Hi All, Sample records 2157 91128 -rw-r----- 1 arun1 staff 93315072 Aug 23 06:44 /home/arun/my own/file_name.txt 2157 91128 -rw-r----- 1 arun1 staff 93315072 Aug 23 06:44 /home/arun/myown/file name2.txt i want to print only user name, user group, size, date time stamp, and... (5 Replies)
Discussion started by: Arunprasad
5 Replies

7. UNIX and Linux Applications

Calender/docket software

We are running in a Linux/Samba environment. Can anyone suggest calendar/docket software that will run in our environment? (0 Replies)
Discussion started by: kbweiss
0 Replies

8. Shell Programming and Scripting

Enter number of days and get calender

Friends need assistance in getting a script either on shell or perl. Below is the situation Taking Today's calender into consideration with Month,Day,Year current .Using that i would like give number of days to get its month,day,year for future or past calender depending on the + or - days... (8 Replies)
Discussion started by: ajayram_arya
8 Replies

9. Shell Programming and Scripting

Facing problem while having time popup from inline calender

I have CGI Perl script that contains date column and date popup will be displayed from inline calender. I had a html script for the same and converted the same to CGI script. html page worked fine but no luck with CGI script. Could anyone please look into the below script and let me know... (1 Reply)
Discussion started by: scriptscript
1 Replies

10. Shell Programming and Scripting

sed and awk giving error ./sample.sh: line 13: sed: command not found

Hi, I am running a script sample.sh in bash environment .In the script i am using sed and awk commands which when executed individually from terminal they are getting executed normally but when i give these sed and awk commands in the script it is giving the below errors :- ./sample.sh: line... (12 Replies)
Discussion started by: satishmallidi
12 Replies
DBIx::ContextualFetch(3pm)				User Contributed Perl Documentation				DBIx::ContextualFetch(3pm)

NAME
DBIx::ContextualFetch - Add contextual fetches to DBI SYNOPSIS
my $dbh = DBI->connect(...., { RootClass => "DBIx::ContextualFetch" }); # Modified statement handle methods. my $rv = $sth->execute; my $rv = $sth->execute(@bind_values); my $rv = $sth->execute(@bind_values, @bind_cols); # In addition to the normal DBI sth methods... my $row_ref = $sth->fetch; my @row = $sth->fetch; my $row_ref = $sth->fetch_hash; my %row = $sth->fetch_hash; my $rows_ref = $sth->fetchall; my @rows = $sth->fetchall; my $rows_ref = $sth->fetchall_hash; my @tbl = $sth->fetchall_hash; DESCRIPTION
It always struck me odd that DBI didn't take much advantage of Perl's context sensitivity. DBIx::ContextualFetch redefines some of the various fetch methods to fix this oversight. It also adds a few new methods for convenience (though not necessarily efficiency). SET-UP my $dbh = DBIx::ContextualFetch->connect(@info); my $dbh = DBI->connect(@info, { RootClass => "DBIx::ContextualFetch" }); To use this method, you can either make sure that everywhere you normall call DBI->connect() you either call it on DBIx::ContextualFetch, or that you pass this as your RootClass. After this DBI will Do The Right Thing and pass all its calls through us. EXTENSIONS
execute $rv = $sth->execute; $rv = $sth->execute(@bind_values); $rv = $sth->execute(@bind_values, @bind_cols); execute() is enhanced slightly: If called with no arguments, or with a simple list, execute() operates normally. When when called with two array references, it performs the functions of bind_param, execute and bind_columns similar to the following: $sth->execute(@bind_values); $sth->bind_columns(undef, @bind_cols); In addition, execute will accept tainted @bind_values. I can't think of what a malicious user could do with a tainted bind value (in the general case. Your application may vary.) Thus a typical idiom would be: $sth->execute([$this, $that], [($foo, $bar)]); Of course, this method provides no way of passing bind attributes through to bind_param or bind_columns. If that is necessary, then you must perform the bind_param, execute, bind_col sequence yourself. fetch $row_ref = $sth->fetch; @row = $sth->fetch; A context sensitive version of fetch(). When in scalar context, it will act as fetchrow_arrayref. In list context it will use fetchrow_array. fetch_hash $row_ref = $sth->fetch_hash; %row = $sth->fetch_hash; A modification on fetchrow_hashref. When in scalar context, it acts just as fetchrow_hashref() does. In list context it returns the complete hash. fetchall $rows_ref = $sth->fetchall; @rows = $sth->fetchall; A modification on fetchall_arrayref. In scalar context it acts as fetchall_arrayref. In list it returns an array of references to rows fetched. fetchall_hash $rows_ref = $sth->fetchall_hash; @rows = $sth->fetchall_hash; A mating of fetchall_arrayref() with fetchrow_hashref(). It gets all rows from the hash, each as hash references. In scalar context it returns a reference to an array of hash references. In list context it returns a list of hash references. ORIGINAL AUTHOR
Michael G Schwern as part of Ima::DBI CURRENT MAINTAINER
Tony Bowden <tony@tmtm.com> LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
DBI. Ima::DBI. Class::DBI. perl v5.10.0 2005-09-27 DBIx::ContextualFetch(3pm)
All times are GMT -4. The time now is 02:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy