LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-07-2014, 11:31 PM   #1
Cordacc
LQ Newbie
 
Registered: Oct 2014
Posts: 2

Rep: Reputation: Disabled
New(ish) to command line, need help with automating a program


I have a program that can take an initial rule and an initial (or randomized) file and iterate a certain number of times giving me a new result.
the results would look something like:
{"version":1,"description":"Hyperbolic cellular field","rule":"B3/S23","state":0,"cells":[{"state":1,"path":[3]},{"state":1,"path":[]},{"state":1,"path":[1]},{"state":1,"path":[7]},{"state":1,"path":[5]},{"state":1,"path":[1,1]},{"state":1,"path":[3,2]},{"state":1,"path":[9]}]}
I want to be able to pick a rule out of a document which is a list of rules, run that rule through various starting positions for a certain amount of iterations and then save that new file. Of course stopping once computing gets slow and if the iterations get into a repeating pattern. I then want to be able to take the file and figure out the state 1 that's farthest way from the center (the state 1 with the most commas) and how many state 1 cells there are at the end, record these values and then repeat with a new initial configuration a couple of times and then move onto a new rule from that document, apply it to the same starting configurations, etc...
So far I have some commands that I think might be helpful, but I'm not sure how to put it all together:

cat huge.json | tr '}' '\n' | grep -c '"state":1'

zcat huge.json.gz | tr '}' '\n' | grep -c '"state":1'

man seq
man xargs
man tr
man awk

zcat huge.json.gz | tr '}' '\n' | tr -d -C ',\n' | awk '{print
length}' | sort -n | tail -1
 
Old 10-08-2014, 08:27 AM   #2
Cordacc
LQ Newbie
 
Registered: Oct 2014
Posts: 2

Original Poster
Rep: Reputation: Disabled
If anyone is curious, the program in question is https://github.com/dmishin/Pentagrid
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
New(ish) distros making users fear the command line? corbintechboy General 60 06-11-2009 03:07 PM
How to use c++ to use a command line program jboss1995 Programming 4 04-05-2008 10:22 PM
need a command line email program paperdiesel Linux - Software 10 09-05-2006 06:32 AM
Viewing program messages when program isn't run from command line? Locura Linux - Software 1 09-27-2003 08:19 AM
command line program installation popcorn5714 Linux - Newbie 4 09-14-2002 03:22 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration