PRODUCT






Home









Free Download








Installation Instructions





FAQ





FAQ








Ask A Question





LEARN SCRIPTING





Overview








Lesson 1








2


3


4


5








Exam





SAMPLE SCRIPTS





Computer








Internet








Administrators








Developers








Data








Miscellaneous





HELP / DOCUMENTATION





Commands








Automated Internet








Automated Editors








Sample Scripts








Precompiled Functions








System Features






  Help Page - SS_CSV

( Some help pages may not display correctly in html because those help pages may have sample code
in them, part of which may be mis-interpreted as html tags.

All help pages, including this help page, are available in biterScripting with the help command. )




Sample Script SS_CSV Purpose Processes data in a csv (comma separated values) file. Source Code ##################################################################### # SCRIPT: SS_CSV # # This sample script shows how to process a csv (comma separated values) file. # # In this sample script, we are using a csv file that lists stock trading data # in the following format. # # ticker,open,close,high,low # # Each line contains data for one ticker (stock symbol). All fields for that # ticker are separated by commas on that line. The following is an example of # one such data file. # # ABC,5.0,5.32,5.67,4.78 # DEF,11.67,10.74,11,67,10.32 # # The name of the csv file (data file) is passed to the script via argument csv. # # This sample script parses the csv file, extracts each ticker data one by one, and # prints out the ticker if the following condition is met. # # (close > open) AND (high > open) # # You can edit the script to change this condition to meet your exact requirements. # # This script can be stored and edited as necessary, in a text file # called SS_CSV.txt, in directory C:/Scripts. The script can then be called as # # script SS_CSV.txt csv("C:/data.csv") # # assuming the data file is at C:/data.csv . # # biterScripting can be downloaded free from http://www.biterscripting.com # ##################################################################### # Declare Farguments. var str csv # Read the contents of the file into a string variable. var str data cat $csv > $data # Read tickers one by one while ($data <> "") do var str line lex "1" $data > $line # The data for this ticker is in $line. Extract all the fields. Note that # some of the fields have the type real (open, close, ...), so we will make use # of appropriate makeXXX() functions to convert string values to values of other types. var str ticker var real open, close, high, low set $ticker = { wex -p "1" $line } set $open = makereal(str({ wex -p "2" $line })) set $close = makereal(str({ wex -p "3" $line })) set $high = makereal(str({ wex -p "4" $line })) set $low = makereal(str({ wex -p "5" $line })) # Print this ticker if it meets our condition. if ( ($close > $open) AND ($high > $open) ) # Meets our condition echo $ticker endif done

© 2008-2013, biterScripting.com. All rights reserved.
biterScripting, biterScript, biterBrowser, biterMobile, biterScripting.com, FVA (Forward Variable Assignment) are trademarks of biterScripting.com. Is it biterScripting-compatible ? is a service mark of biterScripting.com. Explorer, Unix, Windows are trademarks, service marks or other forms of intellectual property of their respective owners.