I don't think we can retrieve values from awk to unix shell... when awk finishes we loose all it values... I can provide you another alternative method instead of creating and parsing it..
Hi All,
I have declared a variable in script1 and assign a value for it. In script2 i'll call script1 and then I want the value of variables set in script1.
I have tried with export, but in vain.
How can I achive this?
Below is the two scripts.
--script1
#!/usr/bin/ksh
echo $1... (1 Reply)
Heres an example.....
<~/abc>$ cat textfile
line 1
line 2
line 3
line 4
line 5
<~/abc>$ cat try.sh
#/bin/ksh
for runs in 1 2 3
do
A=$runs
echo "Inside A : $A"
done
echo "Outside A : $A" <- works fine (1 Reply)
i'm new to shell scripting and have a problem please help me
in the script i have a nawk block which has a variable count
nawk{
.
.
.
count=count+1
print count
}
now i want to access the value of the count variable outside the awk block,like..
s=`expr count / m`
(m is... (5 Replies)
Hi all,
I hav created one profile file in which i have declared some variables
i want to knw how can i access these variables into my xyz.ksh file when i am trying to do " echo $variablename " its giving me an empty line i have done export variable also in the profile file.
Thanks in... (6 Replies)
I call my script with two parameters
myscript.sh aaa bbb
What is the way to access $1 and $2 values inside a function? I call the function like this
myfuntion $1 $1
but inside of the function, $1 and $2 are empty. Any suggestions? thank you in advanced. (1 Reply)
Hi ,
I'm trying to change the variable value in a while loop , however its not working it seems that the problem with subshells while reading the file.
#!/bin/sh
FLAG=0;
cat filename | while read data
do
FLAG=1;
done
echo $FLAG
Should display 1 instead displays 0 (13 Replies)
If I set a variable within a while-read loop, sometimes it's local to the loop, sometimes it's global, depending on how the loop is set up. I'm testing this on a Debian Lenny system using both bash and dash with the same results.
For example:
# Pipe command into while-read loop
count=
ls -1... (2 Replies)
Friends,
I am using ksh under SunoS. This is what I have
In file1.sh
NOW=$(date +"%b-%d-%y")
LOGFILE="./log-$NOW.log"
I will be using this file through file1.sh as log file.
I have another script file2.sh which is being called inside my file1.sh. I would like to use the same log... (6 Replies)
Hello forum,
I am siva working as programmer .I was blocked with the below issue so please help any of the forum memebers.
testve.h
class cv
{
protected :
struct state;
state& m_state;
};
testVe.cpp
struct state
{
m_size;
}
the above are 2 files which have the... (3 Replies)
Discussion started by: workforsiva
3 Replies
LEARN ABOUT MOJAVE
english
English(3pm) Perl Programmers Reference Guide English(3pm)NAME
English - use nice English (or awk) names for ugly punctuation variables
SYNOPSIS
use English;
use English qw( -no_match_vars ) ; # Avoids regex performance penalty
# in perl 5.16 and earlier
...
if ($ERRNO =~ /denied/) { ... }
DESCRIPTION
This module provides aliases for the built-in variables whose names no one seems to like to read. Variables with side-effects which get
triggered just by accessing them (like $0) will still be affected.
For those variables that have an awk version, both long and short English alternatives are provided. For example, the $/ variable can be
referred to either $RS or $INPUT_RECORD_SEPARATOR if you are using the English module.
See perlvar for a complete list of these.
PERFORMANCE
NOTE: This was fixed in perl 5.20. Mentioning these three variables no longer makes a speed difference. This section still applies if
your code is to run on perl 5.18 or earlier.
This module can provoke sizeable inefficiencies for regular expressions, due to unfortunate implementation details. If performance matters
in your application and you don't need $PREMATCH, $MATCH, or $POSTMATCH, try doing
use English qw( -no_match_vars ) ;
. It is especially important to do this in modules to avoid penalizing all applications which use them.
perl v5.18.2 2014-01-06 English(3pm)