Results 1 to 6 of 6
I have a very large flat file that I would like to copy but drop those records that have a field (like Positions 145 to 152) that is less than ...
- 01-06-2009 #1Just Joined!
- Join Date
- Jan 2009
- Posts
- 3
I need to drop records from afile.
I have a very large flat file that I would like to copy but drop those records that have a field (like Positions 145 to 152) that is less than a certain Value. I've searched for tools, Unix/linux commands, etc, but I can not find a simple way to do this.
Can someone help and point the way?
Thanks in advance!
Rock
- 01-06-2009 #2Just Joined!
- Join Date
- Jan 2009
- Posts
- 15
I am sorry, but could you try to explain that a little more clearly. A flat file? You mean as in a document, or do you mean a database file? In either case, if you are trying to move the file to a different location then you should be able to just right-click, copy/cut, and then paste to wherever. If the file is in a Root folder then you will need to be Root to access it.
- 01-07-2009 #3Just Joined!
- Join Date
- Jan 2009
- Posts
- 3
By flat file, I mean a series of fixed length text records. The file contains over 10 million records with a date in a certain location. I want to copy the file so that the new file will have only those records which have a date greater than "20080630" (YYYYMMDD). I need to do this to avoid space and performance issues.
On the IBM Mainframes, there are some file processing/audit/reporting software packages like EasyTrieve and DYL-280. I was looking for a program that had some of the more basic features of those programs.
Rock
- 01-07-2009 #4Just Joined!
- Join Date
- Jan 2009
- Posts
- 15
Sorry about that. I understand your question now, but I do not know what else you could use, or how you would even go about this. To get a proper answer to that question you might want to move your question to the Networking or Application part of this forum. That way you will get the attention of people on that level of understanding. Again, sorry about that, but the majority of my knowledge is limited to home computing, networking, and a little programming.
- 01-07-2009 #5
Well, you could use a bash script to do that for you.
Something to the effect of:
Assuming the date is in the 145th position:
You should have all records with a date greater or equal to 30-06-2008 in a file called newfile.Code:#!/bin/bash MINIMUMDATE="20080630" for i in `cat file` ; do DATETEST=`echo $i|awk '{print $145}'` if [ $DATETEST -ge $MINIMUMDATE ] ; then echo $i >> newfile fi doneCan't tell an OS by it's GUI
- 01-07-2009 #6Just Joined!
- Join Date
- Jan 2009
- Posts
- 3
Thank You CamoAnimal.
I will try the script, but if I understand this, I believe that will do the trick.
Rock


Reply With Quote