Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Copying part of a data file into another Post 302830009 by latsyrc on Sunday 7th of July 2013 09:32:42 PM
Old 07-07-2013
Quote:
Is this a homework assignment? If not, what is creating your input files?

What shell are you using?

Are all of the integers on a single line in your input files?

This is not a homework assignment. The integers are the number of days after a certain date and the data is not available for some days, so some days are missing. Its actually for a project I'm working on. I am creating a regression model using the data via ampl. Now, I would like to analyse just the data after certain date. So, I thought there must be an easy way to separate out the data I want, using UNIX.

I am using bash and there is one integer on a single line.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Copying some part of file

Hey friends, Here I am with another query. I have a TXT file. Foe an example EX ID : B-Mezine .... ... ... Some lines of text (Not fixed in length n no of lines).. ... ... .. END EX ID Some blank lines in between two records(Not fixed in numbers) EX ID : B-Mezine .... ...... (20 Replies)
Discussion started by: anushree.a
20 Replies

2. Shell Programming and Scripting

Copying data from excel file

Hii friends, I am a newbie to unix/shell scripting and got stuck in implementing a functionality.Dear experts,kindly spare some time to bring me out of dark pit :confused:.. My requirement is somewhat wierd,let me explain what i have and what i need to do... 1) there are several excel... (1 Reply)
Discussion started by: 5ahen
1 Replies

3. UNIX for Dummies Questions & Answers

How to get data only inside polygon created by points which is part of whole data from file?

hiii, Help me out..i have a huge set of data stored in a file.This file has has 2 columns which is latitude & longitude of a region. Now i have a program which asks for the number of points & based on this number it asks the user to enter that latitude & longitude values which are in the same... (7 Replies)
Discussion started by: reva
7 Replies

4. Programming

Doubt in C programming (copying data from one file to another)

Hello, i'm new to the forum and so am i to C programming. Recently i've gotten a task to create a program that will read an existing .bin file and copy the data to a non existing (so i have to create it) .txt file (some type of conversion) Now, i now how to put the arguments, opening and... (5 Replies)
Discussion started by: Lyric
5 Replies

5. Programming

SQL: copying data down

I have a series of observations of which one column is sometimes missing (zero): date temp delta 1977 284.54 29.84 1978 149.82 0 1979 320.71 28.45 1980 176.76 0 1981 854.65 0 1984 817.65 0 1985 990.58 27.98 1986 410.21 0 1987 405.93 0 1988 482.9 0 What I would like to achieve is a... (8 Replies)
Discussion started by: figaro
8 Replies

6. Shell Programming and Scripting

Copying data from files to directories

I have the following that I'd like to do: 1. I have split a file into separate files that I placed into the /tmp directory. These files are named F1 F2 F3 F4. 2. In addition, I have several directories which are alphabetized as dira dirb dirc dird. 3. I'd like to be able to copy F1 F2 F3 F4... (2 Replies)
Discussion started by: newbie2010
2 Replies

7. Solaris

Copying data from one file server to another

Hello people, I have a question regarding transferring data from one file server to another. The server is a Solaris 9 box The old file server is connected via Ethernet cable, and the new file server we are switching is a Fiber channel. can I use the dd if=server:/app1 of=server2:/app1 ... (2 Replies)
Discussion started by: br1an
2 Replies

8. UNIX for Dummies Questions & Answers

Renaming files with part of their pathname and copying them to new directory

Hi I think this should be relatively simple but I can't figure it out. I have several files with the same name in different folders within a directory (the output of a program that I ran). Something like this: ./myAnalysis/item1/round1/myoutput.txt ./myAnalysis/item1/round2/myoutput.txt... (2 Replies)
Discussion started by: jullee
2 Replies

9. Programming

SQL: copying data up

I need to fix an SQL statement in MySQL that should calculate a field using values from two of the columns and I prefer to do this using set-based programming, ie not procedural. What needs to happen is that in a separate column called "delta" the value of "level" is copied depending on whether... (3 Replies)
Discussion started by: figaro
3 Replies

10. UNIX for Beginners Questions & Answers

Grep a section from an UNIX file obtaining only part of the data

Hello, I have a log file that has several sections "BEGIN JOB, End of job" like in the following example: 19/06/12 - 16:00:57 (27787398-449294): BEGIN JOB j1(27787398-449294) JOB1 19/06/12 - 16:00:57 (27787398-449294): DIGIT: 0 number of present logs : 1 19/06/12 - 16:00:57... (4 Replies)
Discussion started by: mvalonso
4 Replies
PX_INSERT_RECORD(3)													       PX_INSERT_RECORD(3)

px_insert_record - Inserts record into paradox database

SYNOPSIS
int px_insert_record (resource $pxdoc, array $data) DESCRIPTION
Inserts a new record into the database. The record is not necessarily inserted at the end of the database, but may be inserted at any position depending on where the first free slot is found. The record data is passed as an array of field values. The elements in the array must correspond to the fields in the database. If the array has less elements than fields in the database, the remaining fields will be set to null. Most field values can be passed as its equivalent php type e.g. a long value is used for fields of type PX_FIELD_LONG, PX_FIELD_SHORT and PX_FIELD_AUTOINC, a double values is used for fields of type PX_FIELD_CURRENCY and PX_FIELD_NUMBER. Field values for blob and alpha fields are passed as strings. Fields of type PX_FIELD_TIME and PX_FIELD_DATE both require a long value. In the first case this is the number of milliseconds since mid- night. In the second case this is the number of days since 1.1.0000. Below there are two examples to convert the current date or timestamp into a value suitable for one of paradox's date/time fields. Note This function is only available if pxlib >= 0.6.0 is used. PARAMETERS
o $pxdoc - Resource identifier of the paradox database as returned by px_new(3). o $data - Associated or indexed array containing the field values as e.g. returned by px_retrieve_record(3). RETURN VALUES
Returns FALSE on failure or the record number in case of success. EXAMPLES
Example #1 Set the date/time fields in a paradox database to the current date/time <?php $px = px_new(); $fp = fopen("test.db", "w+"); px_create_fp($px, $fp, array(array("timestamp", "@"), array("time", "T"), array("date", "D"))); $curdate = getdate(); $jd = gregoriantojd($curdate["mon"], $curdate["mday"], $curdate["year"]); $days = $jd - 1721425; /* Number of days between 1.1.4714 b.c. and 1.1.0000 */ $secs = $curdate["hours"]*3600 + $curdate["minutes"]*60 + $curdate["seconds"]; px_insert_record($px, array($days*86400000.0 + $secs*1000.0, $secs*1000.0, $days)); $curtimestamp = microtime(true); $days = (int) ($curtimestamp/86400); $secs = $curtimestamp - ($days * 86400.0); $days += 2440588; /* Number of days between 1.1.4714 b.c. and 1.1.1970 */ $days -= 1721425; /* Number of days between 1.1.4714 b.c. and 1.1.0000 */ px_insert_record($px, array($days*86400000.0 + $secs*1000.0, $secs*1000.0, $days)); for($i=0; $i<2; $i++) { $rec = px_retrieve_record($px, $i); echo px_timestamp2string($px, $rec["timestamp"], "n/d/Y H:i:s")." "; echo px_date2string($px, $rec["date"], "n/d/Y")." "; } px_close($px); px_delete($px); ?> The above example will output: 2/21/2006 21:42:30 2/21/2006 2/21/2006 20:42:30 2/21/2006 The Julian day count as passed to jdtogregorian(3) has a different base of 1.1.4714 b.c. and must therefore be calculated by adding 1721425 to the day count used in the paradox file. Turning the day count into a timestamp is easily done by multiplying with 86400000.0 to obtain milli seconds. SEE ALSO
px_update_record(3) PHP Documentation Group PX_INSERT_RECORD(3)
All times are GMT -4. The time now is 11:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy