# Script parse.txt
# Input argument - path of input file.
var str path
# Read input into a variable.
var str input ; cat $path > $input
# Keep going until there is a next record.
while ( { sen "^[^" $input } > 0 )
do
# Discard portion up to (and including) the next [.
stex "^^" $input > null
# The next word is the id.
var str id ; wex "1" $input > $id
# Discard portion up to (and including) the third (3) quote.
stex "^,^]" $input > null
# The second word is the program.
var str program ; wex "2" $input > $program
# Show the extracted id and program.
echo $id "\t" $program
done
This script will do it. It is in biterscripting ( http://www.biterscripting.com ) Save the script as C:\Scripts\parse.txt. Start biterscripting. Assuming your input file is at C:\input.log, call the script by entering the following command.
script parse.txt path("C:\input.log")
Let me know if this works for you.
Jenni
In reply to Re: Parsing log file with biterscripting
by JenniC
in thread Basic regex to parse source code
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |