What's the best way to read a fixed length record in Perl. I know to read a file like:
ABCDE 302
DEFGC 876
I can do
while (<FILE>) {
$key = substr($_, 0, 5);
$value = substr($_, 7, 3);
}
but isn't there a way to do this with read/unpack?
...
I'm working a .NET web service that will be processing a text file with a relatively long, multilevel record format. Each record in the file represents a different entity; the record contains multiple sub-types. (The same record format is currently being processed by a COBOL job, if that gives you a better picture of what we're looking a...
Given the maximum possible value, how to simply express the space needed to write such number in decimal form as text ?
The real task: logging process ids (pid_t) with fixed length, using gcc on Linux. It'd be good to have a compile time expression to be used in the std::setw() iomanipulator.
I have found that linux/threads.h header co...
I need to match a fixed width field on a file layout with a regular expression. The field is numeric/integer, always have four characters and is included in the range of 0..1331. When the number is smaller than 1000, the string is filled with left zeros. So all these examples are valid:
0000
0001
0010
1000
1331
But the following must...
I'm looking for a .NET (much preferably open source in C#) library for dealing with fixed length field text files. It wouldn't be too much to write one, but existing, tested work is always nicer, to start with.
I will be extracting data in fixed length fields from files produced by a PBX. Each PBX has its own file format, as well a se...
I did not see this kind of task done anywhere and was wondering how I could export data in a .prn file format in RoR.
The idea would be to have:
field 1 -> length: 6 chars -> content: "blah"
field 2 -> length: 8 chars -> content: "foo"
field 3 -> length: 4 chars -> content: "bar"
and convert it to a line which would be like:
"blah...
Hi there,
I want to insert multiple values in a table where the value in one of the column increments sequentially. However, the sequence is a bit complex because of business requirements.
The single insert would go something like this:
INSERT INTO blah (col1, col2) VALUES ('SU0001', 'myemail');
Now, col1 is the value that needs to ...
What is the fastest way to the following in C# 3.5 :
Iterate through files in a directory
Read the file's records (fixed length of 247 characters)
Convert the fixed length string of each record to a Struct or Class.
Thanks
...
I am using the excellent FileHelpers library to process a fixed-length airline schedule file.
I have a date field, then a few fields later on in the record, a time field.
I want to combine both of these in the FileHelpers record class, and know there is a custom FieldConverter attribute. With this attribute, you provide a custom functi...
Is there a public / private key encryption scheme that will not change a message's length?
I would like to encrypt a message one packet at a time, but if the packet grows, it would no longer just be one packet long.
...
Hi,
I'm trying to create a file which has the following structure:
- Each line has 32 bytes
- Each line looks like this format string: "%10i %3.7f %3.7f\n"
My Problem is the following: When i have a negative floating point numbers the line gets longer by one or even two characters because the - sign does not count to the "%3.7f".
Is...
I need to read data from a text file where the field lengths and record lengths are fixed. Fields are either zero padded or space padded, always appear in the same order and each record is terminated by a CRLF. The file can have one of three possible record types determined by the first character in the record.
So far I've create a base...
When mocking up test data for our product, or debugging customer data, it would be nice to have an app that is able to highlight columns or groups of columns as fields, or even to have the editor be aware of which columns are grouped together into fields.
Currently using Vim, which is the best I've come across so far for this task. I'm...