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
PDOSTATEMENT.EXECUTE(3) 						 1						   PDOSTATEMENT.EXECUTE(3)

PDOStatement::execute - Executes a prepared statement

SYNOPSIS
public bool PDOStatement::execute ([array $input_parameters]) DESCRIPTION
Execute the prepared statement. If the prepared statement included parameter markers, you must either: ocall PDOStatement.bindParam(3) to bind PHP variables to the parameter markers: bound variables pass their value as input and receive the output value, if any, of their associated parameter markers oor pass an array of input-only parameter values PARAMETERS
o $input_parameters - An array of values with as many elements as there are bound parameters in the SQL statement being executed. All values are treated as PDO::PARAM_STR. You cannot bind multiple values to a single parameter; for example, you cannot bind two values to a single named parameter in an IN() clause. You cannot bind more values than specified; if more keys exist in $input_parameters than in the SQL specified in the PDO::prepare, then the statement will fail and an error is emitted. RETURN VALUES
Returns TRUE on success or FALSE on failure. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.2.0 | | | | | | | The keys from $input_parameters must match the | | | ones declared in the SQL. Before PHP 5.2.0 this | | | was silently ignored. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 Execute a prepared statement with bound variables <?php /* Execute a prepared statement by binding PHP variables */ $calories = 150; $colour = 'red'; $sth = $dbh->prepare('SELECT name, colour, calories FROM fruit WHERE calories < :calories AND colour = :colour'); $sth->bindParam(':calories', $calories, PDO::PARAM_INT); $sth->bindParam(':colour', $colour, PDO::PARAM_STR, 12); $sth->execute(); ?> Example #2 Execute a prepared statement with an array of insert values (named parameters) <?php /* Execute a prepared statement by passing an array of insert values */ $calories = 150; $colour = 'red'; $sth = $dbh->prepare('SELECT name, colour, calories FROM fruit WHERE calories < :calories AND colour = :colour'); $sth->execute(array(':calories' => $calories, ':colour' => $colour)); ?> Example #3 Execute a prepared statement with an array of insert values (placeholders) <?php /* Execute a prepared statement by passing an array of insert values */ $calories = 150; $colour = 'red'; $sth = $dbh->prepare('SELECT name, colour, calories FROM fruit WHERE calories < ? AND colour = ?'); $sth->execute(array($calories, $colour)); ?> Example #4 Execute a prepared statement with question mark placeholders <?php /* Execute a prepared statement by binding PHP variables */ $calories = 150; $colour = 'red'; $sth = $dbh->prepare('SELECT name, colour, calories FROM fruit WHERE calories < ? AND colour = ?'); $sth->bindParam(1, $calories, PDO::PARAM_INT); $sth->bindParam(2, $colour, PDO::PARAM_STR, 12); $sth->execute(); ?> Example #5 Execute a prepared statement using array for IN clause <?php /* Execute a prepared statement using an array of values for an IN clause */ $params = array(1, 21, 63, 171); /* Create a string for the parameter placeholders filled to the number of params */ $place_holders = implode(',', array_fill(0, count($params), '?')); /* This prepares the statement with enough unnamed placeholders for every value in our $params array. The values of the $params array are then bound to the placeholders in the prepared statement when the statement is executed. This is not the same thing as using PDOStatement::bindParam() since this requires a reference to the variable. PDOStatement::execute() only binds by value instead. */ $sth = $dbh->prepare("SELECT id, name FROM contacts WHERE id IN ($place_holders)"); $sth->execute($params); ?> NOTES
Note Some drivers require to close cursor before executing next statement. SEE ALSO
PDO.prepare(3), PDOStatement.bindParam(3), PDOStatement.fetch(3), PDOStatement.fetchAll(3), PDOStatement.fetchColumn(3). PHP Documentation Group PDOSTATEMENT.EXECUTE(3)
All times are GMT -4. The time now is 04:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy