10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have an array code and output is below:
echo $1
while read -r fline; do
echo "%%%%%%$fline%%%%%"
fmy_array+=("$fline")
done <<< "$1"
Output:
CR30903 YU0007 SRIL CR30903 Yogesh SRIL
%%%%%%CR30903 YU0007 SRIL%%%%%
%%%%%%CR30903 Yogesh SRIL%%%%%
... (8 Replies)
Discussion started by: mohtashims
8 Replies
2. Shell Programming and Scripting
Hi All,
need help with reading the array and sum of the array elements.
given an array of integers of size N . You need to print the sum of the elements in the array, keeping in mind that some of those integers may be quite large.
Input Format
The first line of the input consists of an... (1 Reply)
Discussion started by: nishantrefound
1 Replies
3. Shell Programming and Scripting
Hi
I wanted to print random elements from an array at bash shell
I use the following code, but I always see first element getting printed
#!/bin/bash
c=1
expressions=(pink red white yellow purple)
while ]; do
echo "The value of RANDOM is $RANDOM"
selectedexpression=${expressions}]};... (5 Replies)
Discussion started by: Priya Amaresh
5 Replies
4. Programming
Hi everyone, :)
I'm trying to make a simple C program that scans an array of chars to see if its elements are similar.
I can't understand what's wrong. Could you help me to fix this? Here is the code.
Thanks!
#include<stdio.h>
int main() {
int arr;
int i, len;
int flag =... (10 Replies)
Discussion started by: IgorGest
10 Replies
5. UNIX for Dummies Questions & Answers
Is there a way to print multiple array elements without iterating through the array using bash?
Can you do something like...
echo ${array}and get all those separate elements from the array? (2 Replies)
Discussion started by: jrymer
2 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I have an array containing following sample information
@array = qw (chr02 chr02 chr02 chr02 chr02 chr03 chr03 chr04 chr04 chr05 chr05 chr05 chr07 chr07) I need to replace all duplicate entries by an underscore to get the following output@array = qw (chr02 _ _ _ _ chr03 _ chr04 _ chr05 _ _... (4 Replies)
Discussion started by: pawannoel
4 Replies
7. UNIX for Dummies Questions & Answers
Hi,
I am writing a BASH shell script. I have an array that will contain IN ANY ORDER the following elements: DAY 8D MO NS.
I would like to erase the element DAY, but since the order of the elements in the array are random, I will not know which element # DAY is (ie it's not as simple as... (3 Replies)
Discussion started by: msb65
3 Replies
8. Shell Programming and Scripting
I try to get a number of elements in an array, using dynamic array name.
I need the array name to be dynamic.
The array name is constructed as 'inf_ln_$nmb', where $nmb is a file line number
So, say I have the arr 'inf_ln_4':
> for (( el=0; el<${#inf_ln_4}; el++ )); do
> echo "$el:... (1 Reply)
Discussion started by: alex_5161
1 Replies
9. UNIX for Dummies Questions & Answers
I have a file with 2 lines and 3 filelds
-bash-3.00$ cat del_old_files.cfg
$DBA_WORK_DIR *sybdba* 30
$DBA_LOG_DIR *sybdba* 30
I have tried to set up arrays for each field (bash shell)
declare -a dirArray=`cut -d' ' -f1 < del_old_files.cfg`
declare -a nameArray=`cut -d' ' -f2 <... (6 Replies)
Discussion started by: jhillier
6 Replies
10. Shell Programming and Scripting
Hi,
Please can someone help to return the array elements from a function. Currently the problem I face is that tempValue stores the value in myValue as a string while I need an array of values to be returned instead of string.
Many Thanks,
Sudhakar
the function called is:
... (5 Replies)
Discussion started by: Sudhakar333
5 Replies