I do tons of data manipulation using the following tools/UDFs
 Code:
; Requires FileIO, CSV, and TimeDiff UDFs

; Pseudo-code - untested - CONFIRM ALL COMMAND SYNTAX!!

Dim $aOut[6]		; need 7 fields to output - change as desired

$ = Open(2, '.\dstfile.csv', 5)

;Load the source data into an array
$aSrcData = FileIO('.\srcfile.txt', 'R')

; Read each line, convert it to an array
For Each $Line in $aSrcData

  ; break line into array based on tabs
  $aLine = Split($Line, Chr(9))

  ; Re-init the output array
  ReDim $aOut[6]

  ; Load the 7 desired output fields from the input line array
  ; Change the number of fields and field IDs as needed  
  $aOut[0] = $aLine[21] ; date field
  $aOut[1] = $aLine[3]
  $aOut[2] = $aLine[4]
  $aOut[3] = $aLine[7]
  $aOut[4] = $aLine[8]
  $aOut[5] = $aLine[9]
  $aOut[6] = $aLine[12]

  ; Now is the time to do any data manipulation to your data...

  ; reformat the date value to use the standard format YYYY/MM/DD
  $aTmp = Split($aOut[0], '.')
  $aOut[0] = $aTmp[2] + '/' + $aTmp[1] + '/' + $aTmp[0]

  ; Get age of record in Days
  $Age = TimeDiff($aOut[0], , 'D')

  ; Process this line if it is less than 30 days old. $Days will contain a decimal value
  ; containing the age as whole and fractional days. (ie 3 days 8 hours will be 3.333)
  If $Age <= 30
    ; Now that you have the OUT array for the current line, output it as CSV
    $Rc = WriteLine(2, CSV($aOut))
  EndIf
Next
The code uses FileIO() to load the source data into an array. From there, each line is processed, being split on TABs into a working array ($aLine). Each field of this array represents a numbered column - just remember that these columns begin with zero! Transfer the column numbers you want into your Out ($aOut) array, which will be easier to work with than trying to manipulate all the source columns. It also allows you to use CSV() to convert the array directly to a CSV format record.

TimeDiff returns the difference in seconds between two dates. The second date defaults to "now" so is not specified, and the format parameter requests the value be returned in Days. From there, it's easy to select records based on age.

The CSV() UDF takes an array and converts it to a CSV record that is written to an output file. Quick & dirty, you can open this directly in Excel and use all kinds of sorting and filtering operations. I often use Kix to gather, manipulate, and create CSV files and use Excel to sort/filter, just because it's often easier than writing the code. ;\)

Once the output file is created, you can reload it using FileIO and use one of the available UDFs to sort the array if you wish to do everything within Kix. Then use FileIO(file, 'W', Array) to write the sorted array back to the file. It's a little more processing to load/sort/save but much easier to code than trying to maintain the output entirely in an array to sort before being written to a file.

There's ONE CRITICAL requirement - your source data MUST have a consistent number of columns, and tabs can only be used as delimiters!

Glenn
_________________________
Actually I am a Rocket Scientist! \:D