Sponsored Content
Top Forums Shell Programming and Scripting Calculate N days from a file output Post 302438657 by iga3725 on Tuesday 20th of July 2010 10:44:23 AM
Old 07-20-2010
Hi daz,

it gives me an error:

Code:
israel@bsades2: /home/israel # awk -v f=0 '/2010/07/10/ {f=0} { print > "file_"f }' /tmp/prueba1
 Syntax Error The source line is 1.
 The error context is
                /2010/07/10/ >>>  { <<<
 awk: 0602-500 Quitting The source line is 1.

What's wrong? Thanks

---------- Post updated at 09:44 AM ---------- Previous update was at 09:17 AM ----------

daz,

What if I the date is 36 days?

thanks
Israel.

Last edited by iga3725; 07-20-2010 at 11:42 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

calculate output

I was wondering can anyone give me a clue how to start script which would do the following: I have 2 numbers as input for example: 100 and 1000 and I need to create file and in that file should be written 100 - 199 200 - 299 300 - 399 400 - 499 500 - 599 600 - 699 700 - 799... (3 Replies)
Discussion started by: amon
3 Replies

2. Shell Programming and Scripting

calculate the number of days left in a month

does any one have any ideas how i would go about calculating the number of days left in the month from a bash script ?. I want to do some operations on a csv file according to the result (8 Replies)
Discussion started by: dunryc
8 Replies

3. Shell Programming and Scripting

Script to calculate user's last login to check if > 90 days

I need a script to figure out if a user's last login was 90 days or older. OS=AIX 5.3, shell=Korn Here's what I have so far: ==== #!/usr/bin/ksh NOW=`lsuser -a time_last_login root | awk -F= '{ print $2 }'` (( LAST_LOGIN_TIME = 0 )) (( DIFF = $NOW - $LAST_LOGIN_TIME )) lsuser -a... (3 Replies)
Discussion started by: pdtak
3 Replies

4. Shell Programming and Scripting

Calculate 30/31 days from today date script

Hi Guys, I was working some time ago n was in need to calculate date 30/31 days from today including Feb (Leap yr stuff). Today date is variable depending on day of execution of script. I tried searching but was not able to get exactly what I needed....So at that I time I implemented by my own... (3 Replies)
Discussion started by: coolgoose85
3 Replies

5. Shell Programming and Scripting

Calculate age of a file | calculate time difference

Hello, I'm trying to create a shell script (#!/bin/sh) which should tell me the age of a file in minutes... I have a process, which delivers me all 15 minutes a new file and I want to have a monitoring script, which sends me an email, if the present file is older than 20 minutes. To do... (10 Replies)
Discussion started by: worm
10 Replies

6. Shell Programming and Scripting

Calculate days between yyyyMmmdd dates on Solaris

I extract dates from the log file and need to calculate days between two dates. My dates are in yyyyMmmdd format. Example: $d1=2011 Oct 21 $d2=2012 Feb 20 I need to calculate the number of days between $d2 and $d1. This is on Solaris. Any ideas? Thanks, djanu (4 Replies)
Discussion started by: djanu
4 Replies

7. Web Development

Calculate the number of days between 2 dates - PHP

Is this code good for this purpose? <?php $date1 = mktime(0,0,0,01,01,1991); $date2 = mktime(0,0,0,03,22,2012); $diff = $date2 - $date1; $days = $diff / (60*60*24); echo ($days . "<br />"); ?> (3 Replies)
Discussion started by: kovacsakos
3 Replies

8. Shell Programming and Scripting

KSH script Not working (calculate days since 1/1/2000 given day 4444)

I am unable to get this KSH script to work. Can someone help. I've been told this should work with KSH93. Which I think I have on Solaris 10. If I do a grep -i version /usr/dt/bin/dtksh I get @(#)Version M-12/28/93d @(#)Version 12/28/93 @(#)Version M-12/28/93 This is correct for... (5 Replies)
Discussion started by: thibodc
5 Replies

9. Shell Programming and Scripting

Calculate the number of days between 2 dates - bash script

I wrote the day calculator also in bash. I would like to now, that is it good so? #!/bin/bash datum1=`date -d "1991/1/1" "+%s"` datum2=`date "+%s"` diff=$(($datum2-$datum1)) days=$(($diff/(60*60*24))) echo $days Thanks in advance for your help! (3 Replies)
Discussion started by: kovacsakos
3 Replies

10. Shell Programming and Scripting

Subtract 2 date columns in .csv file and get output as number of days

Hi, I have one .csv file. I have 2 date columns present in file, column 2 and column 3. I need to calculate how many days exist between 2 dates. I am trying to subtract date column 2 from date column 3. Eg: my file look likes s.no, Start_date,End_Date 1, 7/29/2012,10/27/2012 2,... (9 Replies)
Discussion started by: Dimple
9 Replies
Throwable::Error(3pm)					User Contributed Perl Documentation				     Throwable::Error(3pm)

NAME
Throwable::Error - an easy-to-use class for error objects VERSION
version 0.102080 SYNOPSIS
package MyApp::Error; use Moose; extends 'Throwable::Error'; has execution_phase => ( is => 'ro', isa => 'MyApp::Phase', default => 'startup', ); ...and in your app... MyApp::Error->throw("all communications offline"); # or... MyApp::Error->throw({ message => "all communications offline", phase => 'shutdown', }); DESCRIPTION
Throwable::Error is a base class for exceptions that will be thrown to signal errors and abort normal program flow. Throwable::Error is an alternative to Exception::Class, the features of which are largely provided by the Moose object system atop which Throwable::Error is built. Throwable::Error performs the Throwable and StackTrace::Auto roles. That means you can call "throw" on it to create and throw n error object in one call, and that every error object will have a stack trace for its creation. ATTRIBUTES
message This attribute must be defined and must contain a string describing the error condition. This string will be printed at the top of the stack trace when the error is stringified. stack_trace This attribute, provided by StackTrace::Auto, will contain a stack trace object guaranteed to respond to the "as_string" method. For more information about the stack trace and associated behavior, consult the StackTrace::Auto docs. METHODS
as_string This method will provide a string representing the error, containing the error's message followed by the its stack trace. AUTHORS
o Ricardo SIGNES <rjbs@cpan.org> o Florian Ragwitz <rafl@debian.org> COPYRIGHT AND LICENSE
This software is copyright (c) 2010 by Ricardo SIGNES. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.10.1 2010-07-27 Throwable::Error(3pm)
All times are GMT -4. The time now is 09:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy