how to split this file into blocks and then send these blocks as input to the tool called Yices?

Hello,
I have a file like this:
FILE.TXT:
(define argc :: int)
(assert ( > argc 1))
(assert ( = argc 1))
<check>
#
(define c :: float)
(assert ( > c 0))
(assert ( = c 0))
<check>
#
now, i want to separate each block('#' is the delimeter), make them separate files, and then send them as an input files to a tool called yices. How do I write a shell script to split and send ?:confused::mad::confused:HELP!

$ split -l 5 FILE.TXT spl

This will split FILE.TXT in spla and splb as below.

$ cat spla
(define argc :: int)
(assert ( > argc 1))
(assert ( = argc 1))
<check>
#
$ cat splb
(define c :: float)
(assert ( > c 0))
(assert ( = c 0))
<check>
#

Now u can use this files as input to yices tool.

yices < `ls spl* | xargs`
1 Like

I actually have some more blocks, so if i use the same command, will it be split in the same way to spla, splab, splac etc? and can I write this in a single script? how to do these in a single shell script? i mean what's the exact code? i know my question is stupid :confused: i just dont have time to try myself .. so asking these weird questions :stuck_out_tongue:

Yes it will split whole file like spla, splb, splc, spld,.....till applicable.

split -l 5 FILE.TXT spl
yices < `ls spl* | xargs`
1 Like

can i store the out put of yices and then check that? is there any way to store it in a variable (flags)?

I am not aware of the yices tool. So, I don't have the exact idea how its output is gonna look like. If its very large amount of data than I would prefer u to store output in file rather than in variable. However pick whatever u like from below.

Variable

split -l 5 FILE.TXT spl
fileList=`ls spl* | xargs`
outputVar=`echo "$fileList" | yices`

File

split -l 5 FILE.TXT spl
yices < `ls spl* | xargs` > outputFile
cat outputFile
1 Like