Results 1 to 1 of 1
I'm pretty new with linux scripting so i might not even been looking in the right direction with this problem i have.
Ok I have a working script that reads ...
- 03-02-2009 #1Just Joined!
- Join Date
- Mar 2009
- Posts
- 1
reading file block per block
I'm pretty new with linux scripting so i might not even been looking in the right direction with this problem i have.
Ok I have a working script that reads out a file, change it to another code format and store it in a new file.
Now the problem is that even though it is working when the script does make an error because something in the file wasn't in order it's almost imposible to find the fault part in that file since it's quite large.
So to make it easier I have to be able to cut the file into blocks so the script will read per block rather then the whole file at once. And when the script gets an error i can also print the block that causes it in the error log.
A block starts with a known combination of letters and alwas ends with a empty line, but aren't always the same size.
example:
How can i make the script read this file, but let it do the coding part block per block?Code:abc: first block some information some more info abc: second block some information abc: third block etc. etc.
Also know that such a file can have over 7000 of these blocks of varies sizes.
I am using the ksh shell.
I hope this is enough information, but like i said before i'm quite the beginner, so i might have forgotten something.


Reply With Quote