i would like to pass a variable to awk wherein the variable comes from external loop.
i tried this...
let x=0
until test $x -eq 32
do
cat file | awk '{ print $1 , "Number" , $($x) }' >> output
done
thanks, (4 Replies)
I have an awk statement where I Need to pass an environment variable but I cannot get it to work:
My evironment varible examples below:
$FILE1=/dev/fs/file.new
$FILE2=/dev/fs/file.old
Code below:
awk -F"|" '
BEGIN {
while( getline < "$FILE1" )
{ arr=1 }
}
arr != 1 { print }
'... (12 Replies)
HI all,
some more mistery about AWK, I hope you can help me out:
1)
I have a normal ksh script and sometime I call awk command. I set some variables in the script and I would like to use them up within AWK as well. Unfortunately AWK seems to forget all the variable values outside of its own... (1 Reply)
Hi,
I have a shell script with an ambedded awk script.
i need to pass a script variable to the awk script.
Please help.
Thanks in advance
Himani (3 Replies)
Hello experts,
can I return a value from gawk to a shell script ?
My script as follows,
#Here I want the num value to shell script so that I can use later
gawk '
{
split($0,num,",");
print num
}'
gawk -v no=$number '{print no}'
file1
... (3 Replies)
Read parameter from a text file with one line which stored the date value like 20080831; below is the awk command I used
gawk -F, "{getline RunDate;print $RunDate" text file
When print $RunDate, it display 20080831
Would like to pass this variable to another script to use but not... (6 Replies)
I'm trying to store the response from a nawk command inside of a ksh script. The command is:
text=$(nawk -F: '$1 ~ /${imgArray}/ {print $2}' ${etcDir}/captions.txt)
From what I can tell, the imgArray variable is not being expanding when it is inside the single quote ('). Is there something I... (4 Replies)
I know this topic has been dealt with previously, but the solutions I've seen don't work for me apparently.
I need to pass a variable defined in the shell to one in awk:
$ echo $var1
3
$ cat aaa
aaa 1
bbb 2
ccc 3
ddd 4
eee 5I've tried this, without success:
$ awk... (2 Replies)
Does anyone know of a way to do something similar to this with awk and kill? I want to create the variable in awk and pass that variable to kill.
ps -ef | grep -i chromium | awk '{$2=x}' | kill -9 $x 2>/dev/null (9 Replies)
Hello,
May i please know how do i pass the shell variable to awk expression in the below script. It is returning null
#!/bin/bash
UNINUM=720922
UNINUM_DESC=`awk -F'|' -v UNINUM=$2 '/UNINUM/ {print $4}' datafile`
echo $UNINUM_DESC
datafile
4|First|720194|asdasdad
4|First|720735|asdasdsa... (8 Replies)