String variable concatenation through loop problem
Hi Team!!
Please can anyone tell me why the following line does not work properly?
it seems that str3 variable does not keep its value in order to be concatenated in the next iteration! Thus when i print the result of the line above it returns the str2 value
What i want to do is to add to the existing value of str3 the str2 value (after some trimming).
For example,
if the str2 value has the following values through the iteration
i want in the end the str3 value to be
Any help will be appriciated
Panos
Last edited by Scrutinizer; 03-10-2013 at 02:04 PM..
Reason: some more code tags
my input file contains thousands of lines like below
234A dept of education
9788 dept of commerce
8677 dept of engineering
How do i add a delimeter ':' after FIRST 4 CHARACTERS in a line
234A:dept of education
9788:dept of commerce
8677:dept of engineering (7 Replies)
Hello,
in my script i have this lines of code in a while cycle:
..
let j=i+1
t_prod_$i = `cat myfile.csv | grep world | cut -d ";" -f$j`
let i+=1
...
So if i try an echo $t_prod_$i at the end of the cycle i cannot see
the right value obtained by `cat myfile.csv | grep world |... (5 Replies)
Hi All,
I need to concatenate the values in the array into a variable. Currently the code is :
for (( i=1 ; i <= $minCount ; i++ ))
do
var="${var}""${sample_file}"
done
The output is :
/tmp/1/tmp/2/tmp/3/tmp/4/tmp/5/tmp/6/tmp/7/tmp/8/tmp/9/tmp/10
I need a space between... (1 Reply)
Hi,
First post, so I hope someone can help me with this weirdness :)
I have a number files with some rows of information I want to extract, at the same time I want to add to a string some details from the file. I have found two different ways of looping over rows in a file, but one method... (5 Replies)
Hello,
Trying to concatenate the following using bourne shell:
# !/bin/bash
# this works in bash shell e.g. get the results I am expecting
fnTmp=C$cindex.$station_0.$station_1.$station_3.$ts.tmp
#
# under !/bin/sh
# the results are not the same
Any assistance would be... (8 Replies)
Hi,
I need to generate the text name dynamically in for loop,
ex,
VAR_COPY_FILE1= file path 1
VAR_COPY_FILE2= file path 2
VAR_COPY_FILE3= file path 3
for i in 1 2 3
do
if
then
"do some process here"
fi
done (3 Replies)
Hi all, I'm trying to build a variable name automatically through a for loop for a script I'm working on, basically I want to build the variables named: $JVM_HOME0 or $JVM_HOME1 so that I can loop through some file copy/deletes and a server restart once completed. With the code below, I get this... (3 Replies)
Okay -- I hope I ask this correctly.
I'm working on my little shell script to write vendor names and aliases to files from user input. If a user choose to add to a file, he can do that as well. I'm using a select loop for this function to list all the possible files the user can choose from.... (7 Replies)
I want to append values to same string variable inside a recursive function that I have .. I do not want to write to any file but use a variable..
Can anyone please help with it? Thanks in advance. (6 Replies)
Hi there,
I'm writing a basic script where I want to make a string of 2 numeric fields from a file, which I have done, but the behavior is rather confusing.
I have a file of random values such as:
1 2
3 4
5 6
7 8
9 10
and my awk code is:
BEGIN { FS = " " }
{ str = str $1 $2 }
END {... (7 Replies)