02-27-2007
Hi jacoden,
I have one questions:
Data file may contain empty lines or un-used lines (start with "#" character). Can we exclude them from the arrays.
Last edited by fongthai; 02-27-2007 at 03:09 AM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am a FORTRAN guy and not a UNIX expert by any means so sorry if this sounds dumb, but all I want to do is have a UNIX script which reads data from a file (say 1000 lines worth, each row is a file name) and store it in an array to perform an operation on later. As maddeningly simple as this... (2 Replies)
Discussion started by: yorkdg
2 Replies
2. Shell Programming and Scripting
This is shell programming assignment.
It needs to create a file called .std_dbrc contains
STD_DBROOT=${HOME}/class/2031/Assgn3/STD_DB
(which includes all my simple database files)
and I am gonna use this .std_dbrc in my script file (read the data from the database files)
like this: .... (3 Replies)
Discussion started by: ccwq
3 Replies
3. Shell Programming and Scripting
Hello! I think this should be an easy solution. I have a large file with many fields of data. The first field has a unique identifier (a subject number) for every record for a chunk of data. Something like this:
There were ten experimental conditions (ec), but the ec is identified by only... (11 Replies)
Discussion started by: ccox85
11 Replies
4. Shell Programming and Scripting
Hello Everybody,
I have a question on reading the data from XML file through KSH shell script. In the below file I need to collect the patient control no and its respective insured id. I need to have pair of these values in single line separated by some special character, so that I could use... (2 Replies)
Discussion started by: swame_sp
2 Replies
5. Shell Programming and Scripting
Hi, I would like to read the specific data from file and write the data in the new file.
My data input is something like this..
<EXROP:R=TJ0311T;
ROUTE DATA
R ROUTE PARAMETERS
TJ0311T DETY=UPDR TTRANS=1 FNC=3
MA=628160955000
R=TJ0311D
... (3 Replies)
Discussion started by: bha148
3 Replies
6. Shell Programming and Scripting
Hi Frnds...
I have an input file name.txt and another file named as source.. name.txt is having only one column and source is having around 25 columns...i need to read from name.txt line by line and search it in source file and then save the result in results file..
I have a rough idea about the... (15 Replies)
Discussion started by: ektubbe
15 Replies
7. UNIX for Dummies Questions & Answers
Guys,
I ma beginner to shell scripting.I am looking for a script, "read data from file & pass it on bash script output."
Looking forward for help on this. (9 Replies)
Discussion started by: Geekris
9 Replies
8. UNIX for Dummies Questions & Answers
Hi All,
could you please answer the below question.
1)How to read the data from zip file without unzip?
Regards
Priyanka (2 Replies)
Discussion started by: pspriyanka
2 Replies
9. Shell Programming and Scripting
I have input data looks like this which is a part of a csv file
7,1265,76548,"0102:04"
8,1266,76545,"0112:04"
I need to make the output data should look like this and the output data will be part of text file:
7|1265000 |7654899 |A|
8|12660000 |76545999 |B|
The logic behind the... (6 Replies)
Discussion started by: RJG
6 Replies
10. Shell Programming and Scripting
We have the data looks like below in a log file.
I want to generat files based on the string between two hash(#) symbol like below
Source:
#ext1#test1.tale2 drop
#ext1#test11.tale21 drop
#ext1#test123.tale21 drop
#ext2#test1.tale21 drop
#ext2#test12.tale21 drop
#ext3#test11.tale21 drop... (5 Replies)
Discussion started by: Sanjeev G
5 Replies
LEARN ABOUT SUSE
file::randomaccess
File::RandomAccess(3) User Contributed Perl Documentation File::RandomAccess(3)
NAME
File::RandomAccess - Random access reads of sequential file or scalar
SYNOPSIS
use File::RandomAccess;
$raf = new File::RandomAccess(*FILE, $disableSeekTest);
$raf = new File::RandomAccess($data);
$err = $raf->Seek($pos);
$num = $raf->Read($buff, $bytes);
DESCRIPTION
Allows random access to sequential file by buffering the file if necessary. Also allows access to data in memory to be accessed as if it
were a file.
METHODS
new Creates a new RandomAccess object given a file reference or reference to data in memory.
# Read from open file or pipe
$raf = new File::RandomAccess(*FILE);
# Read from data in memory
$raf = new File::RandomAccess($data);
Inputs:
0) Reference to RandomAccess object.
1) File reference or scalar reference.
2) flag set if file is already random access (disables automatic SeekTest).
Returns:
Reference to RandomAccess object.
SeekTest
Performs test seek() on file to determine if buffering is necessary. If the seek() fails, then the file is buffered to allow random
access. SeekTest() is automatically called from new unless specified.
$result = $raf->SeekTest();
Inputs:
0) Reference to RandomAccess object.
Returns:
1 if seek test passed (ie. no buffering required).
Notes:
Must be called before any other i/o.
Tell
Get current position in file
$pos = $raf->Tell();
Inputs:
0) Reference to RandomAccess object.
Returns:
Current position in file
Seek
Seek to specified position in file. When buffered, this doesn't quite behave like seek() since it returns success even if you seek
outside the limits of the file.
$success = $raf->Seek($pos, 0);
Inputs:
0) Reference to RandomAccess object.
1) Position.
2) Whence (0=from start, 1=from cur pos, 2=from end).
Returns:
1 on success, 0 otherwise
Read
Read data from the file.
$num = $raf->Read($buff, 1024);
Inputs:
0) Reference to RandomAccess object.
1) Buffer.
2) Number of bytes to read.
Returns:
Number of bytes actually read.
ReadLine
Read a line from file (end of line is $/).
Inputs:
0) Reference to RandomAccess object.
1) Buffer.
Returns:
Number of bytes read.
Slurp
Read whole file into buffer, without changing read pointer.
Inputs:
0) Reference to RandomAccess object.
Returns:
Nothing.
BinMode
Set binary mode for file.
Inputs:
0) Reference to RandomAccess object.
Returns:
Nothing.
Close
Close the file and free the buffer.
Inputs:
0) Reference to RandomAccess object.
Returns:
Nothing.
AUTHOR
Copyright 2003-2010 Phil Harvey (phil at owl.phy.queensu.ca)
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
Image::ExifTool(3pm)
perl v5.12.1 2010-01-04 File::RandomAccess(3)