Sponsored Content
Top Forums Programming Can we use write() to modify/update intermediate records in a file Post 302131966 by maverix on Tuesday 14th of August 2007 02:38:57 PM
Old 08-14-2007
Can we use write() to modify/update intermediate records in a file

Hi,

I have a database (a simple .dat file) which has multiple records (structure datatype) in it.
I would like to know if we can use write() system call to update/modify intermediate records in this file (using C). If so, could somegive give a code snippet of the same. :-)

Thanks in advance
Regards
maverix
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Count No of Records in File without counting Header and Trailer Records

I have a flat file and need to count no of records in the file less the header and the trailer record. I would appreciate any and all asistance Thanks Hadi Lalani (2 Replies)
Discussion started by: guiguy
2 Replies

2. Shell Programming and Scripting

Help needed in removing intermediate segments from a pipe delimited segment file

Hi, I just stuckup in doing some regular expressions on a file. I have data which has multiple FHS and BTS segments like: FHS|12121|LOCAL|2323 MSH|10101|POTAMAS|2323 PID|121221|THOMAS|DAVID|23432 OBX|2342|H1211|3232 BTS|0000|MERSTO|LIABLE FHS|12121|LOCAL|2323 MSH|10101|POTAMAS|2323... (3 Replies)
Discussion started by: naren_0101bits
3 Replies

3. UNIX for Advanced & Expert Users

unix script for update or insert records from a file to a oracle table

Hi, I have delimited file(|). Sample data: 1|name|50009|DS24|0|12 2|name|30009|DS24|0|13 3|name|20409|DS24|0|14 4|name|20009|DS24|0|15 5|name|10009|DS24|0|16 I want to load this data into a oracle table (update and insert) Please help me the commands and also... (1 Reply)
Discussion started by: unihp1
1 Replies

4. UNIX for Dummies Questions & Answers

update records in a file using shell script...

Hi, I have a file with 6 columns. First 3 columns together make unique record. I have a variable ($v) which hold a value that is obtained by a caliculaion. I have to replace value in 5th columnn with the value of the variable ($v). The value $v is caliculated from col4 and col6 values. ... (2 Replies)
Discussion started by: new_learner
2 Replies

5. Shell Programming and Scripting

insert a header in a huge data file without using an intermediate file

I have a file with data extracted, and need to insert a header with a constant string, say: H|PayerDataExtract if i use sed, i have to redirect the output to a seperate file like sed ' sed commands' ExtractDataFile.dat > ExtractDataFileWithHeader.dat the same is true for awk and... (10 Replies)
Discussion started by: deepaktanna
10 Replies

6. Shell Programming and Scripting

Push records to array during implicit loop and write to file

NEWBIE ALERT! Hi, I'm 1 month into learning Perl and done reading "Minimal Perl" by Tim Maher (which I enjoyed enoumously). I'm not a programmer by profession but want to use Perl to automate various tasks at my job. I have a problem (obviously) and are looking for your much appreciated help.... (0 Replies)
Discussion started by: jospan
0 Replies

7. Linux

Suggest update of two commands - who to write to?

I think it's about time the df and du commands (executables?) were updated to display gigabyte units without one having to do their own calculations from the -m option (display in megabytes). This is one of those "little nothing" annoyances that, at the same time, would positively show new... (3 Replies)
Discussion started by: SilversleevesX
3 Replies

8. UNIX for Dummies Questions & Answers

Grep specific records from a file of records that are separated by an empty line

Hi everyone. I am a newbie to Linux stuff. I have this kind of problem which couldn't solve alone. I have a text file with records separated by empty lines like this: ID: 20 Name: X Age: 19 ID: 21 Name: Z ID: 22 Email: xxx@yahoo.com Name: Y Age: 19 I want to grep records that... (4 Replies)
Discussion started by: Atrisa
4 Replies

9. Shell Programming and Scripting

Deleting duplicate records from file 1 if records from file 2 match

I have 2 files "File 1" is delimited by ";" and "File 2" is delimited by "|". File 1 below (3 record shown): Doc1;03/01/2012;New York;6 Main Street;Mr. Smith 1;Mr. Jones Doc2;03/01/2012;Syracuse;876 Broadway;John Davis;Barbara Lull Doc3;03/01/2012;Buffalo;779 Old Windy Road;Charles... (2 Replies)
Discussion started by: vestport
2 Replies

10. Shell Programming and Scripting

Remove duplicated records and update last line record counts

Hi Gurus, I need to remove duplicate line in file and update TRAILER (last line) record count. the file is comma delimited, field 2 is key to identify duplicated record. I can use below command to remove duplicated. but don't know how to replace last line 2nd field to new count. awk -F","... (11 Replies)
Discussion started by: green_k
11 Replies
Boulder::Unigene(3pm)					User Contributed Perl Documentation				     Boulder::Unigene(3pm)

NAME
Boulder::Unigene - Fetch Unigene data records as parsed Boulder Stones SYNOPSIS
# parse a file of Unigene records $ug = new Boulder::Unigene(-accessor=>'File', -param => '/data/unigene/Hs.dat'); while (my $s = $ug->get) { print $s->Identifier; print $s->Gene; } # parse flatfile records yourself open (UG,"/data/unigene/Hs.dat"); local $/ = "*RECORD*"; while (<UG>) { my $s = Boulder::Unigene->parse($_); # etc. } DESCRIPTION
Boulder::Unigene provides retrieval and parsing services for UNIGENE records Boulder::Unigene provides retrieval and parsing services for NCBI Unigene records. It returns Unigene entries in Stone format, allowing easy access to the various fields and values. Boulder::Unigene is a descendent of Boulder::Stream, and provides a stream-like interface to a series of Stone objects. Access to Unigene is provided by one accessors, which give access to local Unigene database. When you create a new Boulder::Unigene stream, you provide the accessors, along with accessor-specific parameters that control what entries to fetch. The accessors is: File This provides access to local Unigene entries by reading from a flat file (typically Hs.dat file downloadable from NCBI's Ftp site). The stream will return a Stone corresponding to each of the entries in the file, starting from the top of the file and working downward. The parameter is the path to the local file. It is also possible to parse a single Unigene entry from a text string stored in a scalar variable, returning a Stone object. Boulder::Unigene methods This section lists the public methods that the Boulder::Unigene class makes available. new() # Local fetch via File $ug=new Boulder::Unigene(-accessor => 'File', -param => '/data/unigene/Hs.dat'); The new() method creates a new Boulder::Unigene stream on the accessor provided. The only possible accessors is File. If successful, the method returns the stream object. Otherwise it returns undef. new() takes the following arguments: -accessor Name of the accessor to use -param Parameters to pass to the accessor Specify the accessor to use with the -accessor argument. If not specified, it defaults to File. -param is an accessor-specific argument. The possibilities is: For File, the -param argument must point to a string-valued scalar, which will be interpreted as the path to the file to read Unigene entries from. get() The get() method is inherited from Boulder::Stream, and simply returns the next parsed Unigene Stone, or undef if there is nothing more to fetch. It has the same semantics as the parent class, including the ability to restrict access to certain top-level tags. put() The put() method is inherited from the parent Boulder::Stream class, and will write the passed Stone to standard output in Boulder format. This means that it is currently not possible to write a Boulder::Unigene object back into Unigene flatfile form. OUTPUT TAGS
The tags returned by the parsing operation are taken from the names shown in the Flat file Hs.dat since no better description of them is provided yet by the database source producer. Top-Level Tags These are tags that appear at the top level of the parsed Unigene entry. Identifier The Unigene identifier of this entry. Identifier is a single-value tag. Example: my $identifierNo = $s->Identifier; Title The Unigene title for this entry. Example: my $titledef=$s->Title; Gene The Gene associated with this Unigene entry Example: my $thegene=$s->Gene; Cytoband The cytological band position of this entry Example: my $thecytoband=$s->Cytoband; Counts The number of EST in this record Example: my $thecounts=$s->Counts; LocusLink The id of the LocusLink entry associated with this record Example: my $thelocuslink=$s->LocusLink; Chromosome This field contains a list, of the chromosomes numbers in which this entry has been linked Example: my @theChromosome=$s->Chromosome; STS Multiple records in the form ^STS ACC=XXXXXX NAME=YYYYYY ACC NAME TXMAP Multiple records in the form ^TXMAP XXXXXXX; MARKER=YYYYY; RHPANEL=ZZZZ The TXMAP tag points to a Stone record that contains multiple subtags. Each subtag is the name of a feature which points, in turn, to a Stone that describes the feature's location and other attributes. Each feature will contain one or more of the following subtags: MARKER RHPANEL PROTSIM Multiple records in the form ^PROTSIM ORG=XXX; PROTID=DBID:YYY; PCT=ZZZ; ALN=QQQQ Where DBID is PID for indicate presence of GenPept identifier, SP to indicate SWISSPROT identifier, PIR to indicate PIR identifier, PRF to indicate ??? ORG PROTID PCT ALN SEQUENCE Multiple records in the form ^SEQUENCE ACC=XXX; NID=YYYY; PID = CLONE= END= LID= ACC NID PID CLONE END LID SEE ALSO
Boulder, Boulder::Blast, Boulder::Genbank AUTHOR
Lincoln Stein <lstein@cshl.org>. Luca I.G. Toldo <luca.toldo@merck.de> Copyright (c) 1997 Lincoln D. Stein Copyright (c) 1999 Luca I.G. Toldo This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See DISCLAIMER.txt for disclaimers of warranty. perl v5.10.1 2000-01-18 Boulder::Unigene(3pm)
All times are GMT -4. The time now is 07:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy