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


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to split this file into blocks and then send these blocks as input to the tool called Yices?
# 1  
Old 12-17-2010
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 ?SmilieSmilieSmilieHELP!
# 2  
Old 12-17-2010
Code:
$ split -l 5 FILE.TXT spl

This will split FILE.TXT in spla and splb as below.
Code:
$ 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.
Code:
yices < `ls spl* | xargs`

This User Gave Thanks to For This Post:
R0H0N
# 3  
Old 12-17-2010
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 Smilie i just dont have time to try myself .. so asking these weird questions :P
# 4  
Old 12-17-2010
Yes it will split whole file like spla, splb, splc, spld,.....till applicable.

Code:
split -l 5 FILE.TXT spl
yices < `ls spl* | xargs`

This User Gave Thanks to For This Post:
R0H0N
# 5  
Old 12-17-2010
can i store the out put of yices and then check that? is there any way to store it in a variable (flags)?
# 6  
Old 12-17-2010
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
Code:
split -l 5 FILE.TXT spl
fileList=`ls spl* | xargs`
outputVar=`echo "$fileList" | yices`

File
Code:
split -l 5 FILE.TXT spl
yices < `ls spl* | xargs` > outputFile
cat outputFile

This User Gave Thanks to For This Post:
R0H0N
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to Split a file -- so that each file has N number of Blocks?

Using Linux ,trying to come up with a shell script to automate below but not able to I have a input XML file (XML.txt) with over 200,00 XML blocks, I need to inject this XML file into an application queue for processing, but due to resource contraints I will need to split them up so that each... (5 Replies)
Discussion started by: alldbest
5 Replies

2. Shell Programming and Scripting

How to remove duplicate text blocks from a file?

Hi All I have a list of files which will have duplicate list of blocks of text. Following is a sample of the file, I have removed the sensitive information from the file. All the code samples starts from <TR BGCOLOR="white"> and Ends with IP address and two html tags like this. 10.14.22.22... (3 Replies)
Discussion started by: mahasona
3 Replies

3. Shell Programming and Scripting

Adding and removing blocks of text from file

Hello all, short story: I'm writing a script to add and remove dns records in dns files. Its on a RHEL 5.5 So far i've locked up the basic operations in a couple of functions: - validate the parameters - search for existant ip in file when adding - search for existant name records in... (6 Replies)
Discussion started by: maverick72
6 Replies

4. Shell Programming and Scripting

Row blocks to column blocks

Hello, Searched for a while and found some "line-to-column" script. My case is similar but with multiple fields each row: S02 Length Per S02 7043 3.864 S02 54477 29.89 S02 104841 57.52 S03 Length Per S03 1150 0.835 S03 1321 0.96 S03 ... (9 Replies)
Discussion started by: yifangt
9 Replies

5. Shell Programming and Scripting

Extracting data blocks from file

Hi all, I want to extract blocks of data from a file depending on the contents of that block. The input file(table) has several blocks each starting with 'gene' in the first column. I want to extract only those blocks which do not have the expression '_T02' in the second column. Input file ... (3 Replies)
Discussion started by: newbie83
3 Replies

6. UNIX for Dummies Questions & Answers

Convert 512-blocks to 4k blocks

I'm Unix. I'm looking at "df" on Unix now and below is an example. It's lists the filesystems out in 512-blocks, I need this in 4k blocks. Is there a way to do this in Unix or do I manually convert and how? So for container 1 there is 7,340,032 in size in 512-blocks. What would the 4k block be... (2 Replies)
Discussion started by: rockycj
2 Replies

7. Shell Programming and Scripting

Removing blocks from a file

I have a file like the one below. Each record is separated with > In between I have lines consisting of 3 numeric values separated by a space. I need to take each block between the > sign and read the first number in the line. Then take the first after the > sign and the last before the >... (7 Replies)
Discussion started by: kristinu
7 Replies

8. Shell Programming and Scripting

extract blocks of text from a file

Hi, This is part of a large text file I need to separate out. I'd like some help to build a shell script that will extract the text between sets of dashed lines, write that to a new file using the whole or part of the first text string as the new file name, then move on to the next one and... (7 Replies)
Discussion started by: cajunfries
7 Replies

9. Solaris

Why does the # of blocks change for a file on a ZFS filesystem?

I created a zpool and zfs filesystem in OpenSolaris. I made two NFS mount points: > zpool history History for 'raidpool': 2009-01-15.17:12:48 zpool create -f raidpool raidz1 c4t1d0 c4t2d0 c4t3d0 c4t4d0 c4t5d0 2009-01-15.17:15:54 zfs create -o mountpoint=/vol01 -o sharenfs=on -o... (0 Replies)
Discussion started by: sqa777
0 Replies

10. Shell Programming and Scripting

Delete blocks of lines from text file

Hello, Hello Firends, I have file like below. I want to remove selected blocks say abc,pqr,lst. how can i remove those blocks from file. zone abc { blah blah blah } zone xyz { blah blah blah } zone pqr { blah blah blah } (4 Replies)
Discussion started by: nrbhole
4 Replies
Login or Register to Ask a Question