linux - C-shell: How to create multiple arrays from a single line of standard input? -
Find a way to accomplish the following tasks using the C-shell (I can not use a different shell) Will be:
is a program that extract multilateral factors from a large polynomial using the Galois field calculations. Output is a single line, and looks like something (ignore the actual value of numbers; I randomly selected them and they do not work mathematically):
(0 1 4 6 7 8 11 12 13) = (0 1) ^ 3 * (0 4 5) * (0 2 4 6) ^ 4 * (0 2 3) ^ 2
Polynomial Mathematics The way that works, if any number increases to any number, then this aspect is not necessarily more than the value of the polynomial. Like multiplying by 1. What I need to do is to remove polynomial factors and to remove excessive factors.
Using sed, I can change the expression above
(0 1) ^ 3 * (0 4 5) * (0206) ^ 4 * (0 2 3) ^ 2
But I am unsure how to proceed.
I want to move it up, input it into a C-shell script, and assign the following array:
Array A = (0 1) array B = ( 0 5 5)
I think the best route will be to separate the polynomial factors in separate lines, such as:
(0 1) ^ 3 (0 4 5) (0 2 4 6) ^ 4 (0 2 3) ^ 2
But I have uncertainty how to do this. / P>
Can anyone give useful help or hints? Keep in mind that the number of polynomial factors will change, but I do not expect to be more than 8. Exponent values are not important; I just need to determine whether they are anywhere or weird or not. I can easily do this if they are assigned to a variable or an array. Probably the maximum possible size of a factor is around 50 persons within the parentheses.
You probably want something like the next:
#! / Bin / tcsh set str = "(0 1) ^ 3 * (0 4 5) * (0 2 4 6) ^ 4 * (0 2 3) ^ 2" echo "my string: === $ str == = "Arrnum = 0" set next line ("echo '$ str' | grep -oP '\ ([^)] * \)'` ') @arm ++ set avaleline = "set array $ ernum = $ line "Aval" $ av_line "and echo" order ARA $ Ernum Array (ARAR 1. ARR $ AR nm) "Forward Eye (` SEC $ erum`) set ARNEMEN = "array $ I" echo "$ arrname content" set temp = 'Eval echo' $ '$ arrname' foreign object object ($ temp) echo $ item end end
It creates array1 .. arrayN is every (xxxxx)
Group For your string:
(0 1) ^ 3 * (0 4 5) * (0 2 4 6) ^ 4 * (0 2 3) ^ 2
My String: === (0 1) ^ 3 * (0 4 5) * (0 2 4 6) ^ 4 * (0 2 3 ) ^ 2 === The contents of 4 arrays (array1. Array4) The contents of array1 1 1 The content of array22 0 4 5 Content of array3 0 2 4 6 Content of array4 0 2 3
Comments
Post a Comment