10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
Is it possible to grep for two files and assign their names to two separate variables with for loop? I am doing the below currently:
if
then
for fname in $( cd $dirA ; ls -tr | grep "^Ucountry_file$")
do
InFile=$dirA/$fname
... (4 Replies)
Discussion started by: swasid
4 Replies
2. Shell Programming and Scripting
Hi, I was wondering if anyone could assist me for (what is probably) a very straightforward answer.
I have input files containing something like
File 1
Apples
Apples
Apples
Apples
File 2
Bananas
Bananas
Bananas
Bananas (4 Replies)
Discussion started by: hubleo
4 Replies
3. Shell Programming and Scripting
my script is some thing like this
i11="{1,2,3,4,5,6,7,8,9,10,11,}"
echo "enter value"
read value ..............suppose i11
x="$value"
echo "$($value)" .............the echo should be {1,2,3,4,5,6,7,8,9,10,11,}
but its showing "i11" only.
plz help me out to get desired... (10 Replies)
Discussion started by: sagar_1986
10 Replies
4. Shell Programming and Scripting
Hi,
Please help me writing for loop to fetch data and store in variable from a text file which contains data as below:
12
46
56
5466
111
There are 40 lines of data...!!!!
I jus need all data from line no 4 to 40 ie data for 4,6,8......40. (2 Replies)
Discussion started by: fidelis
2 Replies
5. Shell Programming and Scripting
Hi folks.
I have this variable called FirstIN that contains something like this: 001,002,003,004...
I am trying to assign the content of this variable into ModifiedIN but with the following format : 001 002 003 004...(changing the commas for spaces)
I thought about using sed but i am not... (17 Replies)
Discussion started by: Stephan
17 Replies
6. Shell Programming and Scripting
Hi
I am new to shell scripting and i am preparing a script.
for now i am work on a sub part of it..but i am unable to make it work.
---
the test code that i am working on
--------------------------
IFS=""
Sample_eve=`psg proc_s | grep tY`
n=0
for line in $Sample_eve... (41 Replies)
Discussion started by: Anteus
41 Replies
7. Shell Programming and Scripting
can we make a global variable and store character values and add other values to that variable ?? for example
a="hello, John"
and can we add value ". How are you? so
a can have
"hello, John. How are you?"
can someone help me?? (2 Replies)
Discussion started by: bonosungho
2 Replies
8. Shell Programming and Scripting
I need to do something like this:
for i in 1 2 3 4 5; do
arr=$(awk 'NR="$i" { print $2 }' file_with_5_records)
done
That is, parse a file and assign values to an array in an ascending order relative to the number of record in the file that is being processed on each loop.
Is my... (2 Replies)
Discussion started by: fiori_musicali
2 Replies
9. Shell Programming and Scripting
Hi All,
While executing following for loop in unix, it is working fine.
sum=0
tot_amt=`for i in `cat amt`
do
sum=`echo "$sum + $i"|bc`
done`
But if i assing this loop in a variable it is not working. The error is so and done is unexpected.
tot_val=`sum=0;tot_amt=`for i in... (3 Replies)
Discussion started by: Amit.Sagpariya
3 Replies
10. Shell Programming and Scripting
If I have 3 variables and I want to check if any of these is null. If one of them is null then it should be assigned a value of 0.I have the following code below.
The output should be 0 is A, 11 is B, 33 is C
$a=
$b=11
$c=33
$echo $a $b $c
$11 33
for i in "${a}" "${b}" "${c}";
do
... (2 Replies)
Discussion started by: thana
2 Replies