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
Glib::OptionContext(3)					User Contributed Perl Documentation				    Glib::OptionContext(3)

NAME
Glib::OptionContext SYNOPSIS
my ($verbose, $source, $filenames) = ('', undef, []); my $entries = [ { long_name => 'verbose', short_name => 'v', arg_type => 'none', arg_value => $verbose, description => 'be verbose' }, { long_name => 'source', short_name => 's', arg_type => 'string', arg_value => $source, description => 'set the source', arg_description => 'source' }, [ 'filenames', 'f', 'filename-array', $filenames ], ]; my $context = Glib::OptionContext->new ('- urgsify your life'); $context->add_main_entries ($entries, 'C'); $context->parse (); # $verbose, $source, and $filenames are now updated according to the # command line options given HIERARCHY
Glib::Boxed +----Glib::OptionContext METHODS
optioncontext = Glib::OptionContext->new ($parameter_string) o $parameter_string (string) $context->add_group ($group) o $group (Glib::OptionGroup) $context->add_main_entries ($entries, $translation_domain) o $entries (scalar) reference to an array of option entries o $translation_domain (string) boolean = $context->get_help_enabled $context->set_help_enabled ($help_enabled) o $help_enabled (boolean) boolean = $context->get_ignore_unknown_options $context->set_ignore_unknown_options ($ignore_unknown) o $ignore_unknown (boolean) optiongroup = $context->get_main_group $context->set_main_group ($group) o $group (Glib::OptionGroup) boolean = $context->parse This method works directly on @ARGV. May croak with a Glib::Error in $@ on failure. SEE ALSO
Glib, Glib::Boxed COPYRIGHT
Copyright (C) 2003-2009 by the gtk2-perl team. This software is licensed under the LGPL. See Glib for a full notice. perl v5.12.1 2010-07-05 Glib::OptionContext(3)
All times are GMT -4. The time now is 10:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy