10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
I have a complicated situational find and replace that I wrote in bash because I didn't know how to do everything in awk. The code works but is very slow, as expected.
To create my modified file, I am looping through an array that was populated earlier and making some replacements at... (6 Replies)
Discussion started by: LMHmedchem
6 Replies
2. Shell Programming and Scripting
What is an efficient way of counting the number of unique values in a 400 column by 1000 row array and outputting the counts per column, assuming the unique values in the array are:
A, B, C, D
In other words the output should look like: Value COL1 COL2 COL3
A 50 51 52... (16 Replies)
Discussion started by: Geneanalyst
16 Replies
3. UNIX for Beginners Questions & Answers
Hi,
tab-separated input:
blabla_1 A,B,C,C
blabla_2 A,E,G
blabla_3 R,Q,A,B,C,R,Q
output:
blabla_1 3
blabla_2 3
blabla_3 5
After splitting $2 in an array, I am trying to store the number of unique elements in a variable, but have some difficulties resetting the variable to 0 before... (6 Replies)
Discussion started by: beca123456
6 Replies
4. Shell Programming and Scripting
hello,
i need a bit of help on how to do this effectively in bash without a lot of extra looping or massive switch/case
i have a long array of M elements and a short array of N elements, so M > N always. M is not a multiple of N.
for case 1, I want to stretch N to fit M
arrayHuge
H = (... (2 Replies)
Discussion started by: f77hack
2 Replies
5. Programming
I get weird decimal digits when I run the program below.
int coe_amount;
cout << "How many coefficients exist in your term? ";
cin >> coe_amount;
float coefficient;
for (int count = 0; count < coe_amount; count ++)
{
... (4 Replies)
Discussion started by: DyslexicChciken
4 Replies
6. Shell Programming and Scripting
Trying to do some control flow parsing based on the index postion of an array member. Here is the pseudo code I am trying to write in (preferably in pure bash) where possible. I am thinking regex with do the trick, but need a little help.
pesudo code
if == ENDSINFIVEINTS ]]; then
do... (4 Replies)
Discussion started by: briandanielz
4 Replies
7. Shell Programming and Scripting
I have an array and two variables as below,
I need to check if $datevar is present in $filename.
If so, i need to replace $filename with the values in the array.
I need the output inside an ARRAY
How can this be done.
Any help will be appreciated. Thanks in advance. (2 Replies)
Discussion started by: irudayaraj
2 Replies
8. Shell Programming and Scripting
Hi,
I'm new to linux & bash so please forgive my ignorance, just wondering if anyone can help.
I have a file (mainfile.txt) with comma deliminated values, like so:
$1 $2 $3
613212, 36, 57
613212, 36, 10
613212, 36, 10
677774, 36, 57
619900, 10, 10
i need to split this file... (12 Replies)
Discussion started by: BigTOE
12 Replies
9. UNIX for Advanced & Expert Users
Hi all,
Following code in ksh is giving error:
fileLimit=5
func(){
dir="$1"
format="$2"
array="$3"
i=0
ls -lrt $format | tail -${fileLimit} | while read f_det; do
files="${f_det},"
((i+=1))
done
eval $(echo set -A $array '"${files}"')
}
func "." "*.pl" "a"
echo... (10 Replies)
Discussion started by: PRKS
10 Replies
10. Programming
I am facing a strange error while creating posix threads:
Given below are two snippets of code, the first one works whereas the second one gives a garbage value in the output.
Snippet 1
This works:
--------------
int *threadids;
threadids = (int *) malloc (num_threads * sizeof(int));
... (4 Replies)
Discussion started by: kmehta
4 Replies