Sponsored Content
Homework and Emergencies Homework & Coursework Questions Displaying specific lines from a CSV file Post 302392152 by vbe on Wednesday 3rd of February 2010 12:34:56 PM
Old 02-03-2010
You dont find a birthday that matches today, then what?
You are to write an algorithm using a loop (e.g. while....) until you find the next date after hoping you are not at EOF...

remember your will have to deal with changing months with your increment....

Good luck
Courage!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Displaying specific lines in a file.

I'm trying to figure out how to display a certain line in a text file. I keep getting references to Tail and Head, and I know how these work, but i'm lost on how to find say the third out of the five lines and display only that. I thought maybe grep could help, but that doesn't seem likely. ... (3 Replies)
Discussion started by: MaestroRage
3 Replies

2. Shell Programming and Scripting

Displaying the Last Modification Time of a specific file

How can I get and display the last modification time of a file? in scripting or specifically using Batch file I want this info for me to determine whether an image has been edited or not by using the last modification time and compare it to our stored date of modification. can somebody help... (5 Replies)
Discussion started by: jaque18
5 Replies

3. UNIX for Dummies Questions & Answers

how to display specific lines of a specific file

are there any basic commands that can display lines 99 - 101 of the /etc/passwd file? I'm thinking use of head and tail, but I forget what numbers to use and where to put /etc/passwd in the command. (2 Replies)
Discussion started by: raidkridley
2 Replies

4. Shell Programming and Scripting

Displaying number of lines from file

Hi, I am using below command to display the number of line, but its returning no of lines along with file name. But i want only no of line in the variable p. Please help me on this? p=`wc -l "text file"` echo "$p" (6 Replies)
Discussion started by: shivanete
6 Replies

5. UNIX for Dummies Questions & Answers

Displaying specific columns in a file

Hi, I'm just wondering how you display a specific set of columns of a specified file in Unix. For example, if you had an AddressBook file that stores the Names, Phone numbers, and Addresses of people the user entered in the following format (the numbers are just to give an idea of what column... (1 Reply)
Discussion started by: logorob
1 Replies

6. Shell Programming and Scripting

Displaying lines of a file where the second field matches a pattern

Howdy. I know this is most likely possible using sed or awk or grep, most likely a combination of them together, but how would one go about running a grep like command on a file where you only try to match your pattern to the second field in a line, space delimited? Example: You are... (3 Replies)
Discussion started by: LordJezoX
3 Replies

7. Shell Programming and Scripting

Displaying lines of a file which have the highest number?

Hello Wondering if anybody may be able to advise on how I can filter the contents of the following file: <object_name>-<version> <Instance> GM_GUI_code.fmb-4 1 GM_GUI_code.fmb-5 1 GM_GUI_code.fmx-4 ... (7 Replies)
Discussion started by: Glyn_Mo
7 Replies

8. Shell Programming and Scripting

insert data into specific lines of a CSV

So I work in a 1 to 1 laptop deployment and sometimes we need to mass order parts. The vendor will send us a text file and we have to manually input serial numbers. Well I have a full blown web based inventory system which I can pull serial number reports from. I then have to input the part... (4 Replies)
Discussion started by: tlarkin
4 Replies

9. UNIX for Dummies Questions & Answers

Quick UNIX command to display specific lines in the middle of a file from/to specific word

This could be a really dummy question. I have a log text file. What unix command to extract line from specific string to another specific string. Is it something similar to?: more +/"string" file_name Thanks (4 Replies)
Discussion started by: aku
4 Replies

10. UNIX for Beginners Questions & Answers

Convert a horizontal lines to vertical lines in a csv file

Hi.. I need some help in converting the below horizontal lines to vertical lines format. can anyone help me on this. input file Hour,1,2,3,4,5 90RT,106,111,111,112,111 output file Hour,90RT 1,106 2,111 3,111 4,112 5,111 (3 Replies)
Discussion started by: Raghuram717
3 Replies
Rose::Object::MakeMethods::DateTime(3pm)		User Contributed Perl Documentation		  Rose::Object::MakeMethods::DateTime(3pm)

NAME
Rose::Object::MakeMethods::DateTime - Create methods that store DateTime objects. SYNOPSIS
package MyObject; use Rose::Object::MakeMethods::DateTime ( datetime => [ 'birthday', 'arrival' => { tz => 'UTC' } ], ); ... $obj = MyObject->new(birthday => '1/24/1984 1am'); $dt = $obj->birthday; # DateTime object $bday = $obj->birthday(format => '%B %E'); # 'January 24th' # Shortcut for $obj->birthday->clone->truncate(to => 'month'); $month = $obj->birthday(truncate => 'month'); $obj->birthday('blah'); # croaks - invalid date! $obj->birthday('1999-04-31'); # croaks - invalid date! DESCRIPTION
Rose::Object::MakeMethods::DateTime is a method maker that inherits from Rose::Object::MakeMethods. See the Rose::Object::MakeMethods documentation to learn about the interface. The method types provided by this module are described below. All methods work only with hash-based objects. METHODS TYPES
datetime Create get/set methods for scalar attributes that store DateTime objects. Options "hash_key" The key inside the hash-based object to use for the storage of this attribute. Defaults to the name of the method. "init_method" The name of the method to call when initializing the value of an undefined attribute. This option is only applicable when using the "get_set_init" interface. Defaults to the method name with the prefix "init_" added. This method should return a value that can be parsed by Rose::DateTime::Util's the parse_date() function. If the return value is a DateTime object, it will have its time zone set (see the "tz" option below) using DateTime's set_time_zone() method. "interface" Chooses one of the two possible interfaces. Defaults to "get_set". "tz" The time zone of the DateTime object to be stored. If present, this value will be passed as the second argument to Rose::DateTime::Util's the parse_date() function when creating DateTime objects for storage. If absent, DateTime objects will use the default time zone of the Rose::DateTime::Util class, which is set by Rose::DateTime::Util's time_zone() class method. See the Rose::DateTime::Util documentation for more information. Interfaces "get_set" Creates a get/set accessor method for an object attribute that stores a DateTime object. When called with a single argument, the argument is passed through Rose::DateTime::Util's parse_date() function in order to create the DateTime object that is stored. The current value of the attribute is returned. Passing a value that is not understood by Rose::DateTime::Util's parse_date() function causes a fatal error. When called with two arguments and the first argument is the string 'format', then the second argument is taken as a format specifier which is passed to Rose::DateTime::Util's format_date() function. The formatted string is returned. In other words, this: $obj->birthday(format => '%m/%d/%Y'); Is just a shortcut for this: Rose::DateTime::Util::format_date($obj->birthday, '%m/%d/%Y'); When called with two arguments and the first argument is the string 'truncate', then the second argument is taken as a truncation specifier which is passed to DateTime's truncate() method called on a clone of the existing DateTime object. The cloned, truncated DateTime object is returned. In other words, this: $obj->birthday(truncate => 'month'); Is just a shortcut for this: $obj->birthday->clone->truncate(to => 'month'); Passing more than two arguments or passing two arguments where the first argument is not 'format' or 'truncate' will cause a fatal error. "get_set_init" Behaves like the "get_set" interface unless the value of the attribute is undefined. In that case, the method specified by the "init_method" option is called, the return value is passed through Rose::DateTime::Util's parse_date() function, and the attribute is set to the return value. An init method that returns a value that is not understood by Rose::DateTime::Util's parse_date() function will cause a fatal error. Example: package MyObject; use Rose::Object::MakeMethods::DateTime ( datetime => [ 'birthday', 'arrival' => { tz => 'UTC' } ], 'datetime --get_set_init' => [ 'departure' => { tz => 'UTC' } ], ); sub init_departure { DateTime->new(month => 1, day => 10, year => 2000, time_zone => 'America/Chicago'); } ... $obj = MyObject->new(birthday => '1/24/1984 1am'); $dt = $obj->birthday; # DateTime object $bday = $obj->birthday(format => '%B %E'); # 'January 24th' # Shortcut for $obj->birthday->clone->truncate(to => 'month'); $month = $obj->birthday(truncate => 'month'); $obj->birthday('blah'); # croaks - invalid date! $obj->birthday('1999-04-31'); # croaks - invalid date! # DateTime object with time zone set to UTC $dt = $obj->arrival('2005-21-01 4pm'); # DateTime object with time zone set to UTC, not America/Chicago! # Start with 2000-01-10T00:00:00 America/Chicago, # then set_time_zone('UTC'), # which results in: 2000-01-10T06:00:00 UTC $dt = $obj->departure; print $dt; # "2000-01-10T06:00:00" AUTHOR
John C. Siracusa (siracusa@gmail.com) LICENSE
Copyright (c) 2010 by John C. Siracusa. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2010-10-17 Rose::Object::MakeMethods::DateTime(3pm)
All times are GMT -4. The time now is 09:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy