10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi guys,
I have a file "abc.dat" in below format:
FILE_PATH||||$F_PATH
TABLE_LIST||||a|b|c
SYST_NM||||${SRC_SYST}
Now I am trying to read the above file and want to print the value for above dollar variables F_PATH and SRC_SYST. The problem is it's reading the dollar variables as... (5 Replies)
Discussion started by: abcabc1103
5 Replies
2. Shell Programming and Scripting
i have this variable:
varT="1--2--3--5"
i want to use awk to print field 3 from this variable. i dont want to do the "echo $varT".
but here's my awk code:
awk -v valA="$varT" "BEGIN {print valA}"
this prints the entire line. i feel like i'm so close to getting what i want. i... (4 Replies)
Discussion started by: SkySmart
4 Replies
3. Shell Programming and Scripting
hey,
just want to ask how to do this.
ex.
g="hi i am john"
h=`echo $g | awk '{print $2}'`
echo $h
OUTPUT is 'i'
What if I want to use a variable instead of using '2', how do I do that?
Because this one does not work:
a=2
h=`echo $g | awk '{print ${$a}}'`
this one also does not... (3 Replies)
Discussion started by: h0ujun
3 Replies
4. Shell Programming and Scripting
Hi,
I've stored the output of a command into a variable.
The variable contains the following output:
outputline1 outputline2 outputline3 ...
How can I echo the variable so that the output is as follow and not one line:
outputline1
outputline2
outputline2
...
Thanks a lot! (4 Replies)
Discussion started by: Sego
4 Replies
5. Shell Programming and Scripting
I have list of files:
ls
a.pdf
b.pdf
c.pdf
and so on...
and I have a file like this:
cat file1
apple
mango
pear
and so on...
I want to rename my file like this: (7 Replies)
Discussion started by: zorrox
7 Replies
6. Shell Programming and Scripting
Hi all,
I have a variable say var1 (output from somewhere, which I can't change)which store something like this:
echo $var1
name=fred
age=25
address="123 abc"
password=pass1234
how can I make the variable $name, $age, $address and $password contain the info?
I mean do this in a... (1 Reply)
Discussion started by: freddy1228
1 Replies
7. Shell Programming and Scripting
I have defined variable in linux using command #year=twenty
Now i want to use CGI script to print this value.
how can i do so?
quick response will be highly appreciated. (6 Replies)
Discussion started by: bhavesh.sapra
6 Replies
8. Shell Programming and Scripting
:b:Hi All,
I have a part of a script below:
var1="value1"
awk 'BEGIN {printf("%36s \n ","value1")}'
Instead of directly giving the "value1" , I need to give using "var1" in the above awk statement.
Is this possible?
If so, what is the modified awk command?
Thanks in advance
JS (1 Reply)
Discussion started by: jisha
1 Replies
9. Shell Programming and Scripting
How can I pass the name of the variable inside a for statment
I have a script something like below:
classA=12
classB=14
classC=16
# classD = 20
all_class="classA classB classC"
for i in $all_class
do
echo $i = $($i) #<---- this one not work
#echo $i = $(echo $i) ... (1 Reply)
Discussion started by: sun-guy
1 Replies
10. Shell Programming and Scripting
i read the variable ph from file and i wanna to print it in awk.
example
ph=`cat tmpbatch`
tail h.txt|grep "| |"|awk -F"|" '{ print "@unpdx.sql",$5 }'"$ph"
i try this but it does not work (8 Replies)
Discussion started by: kazanoova2
8 Replies