10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I need to set "prd" in the below command to a unix variable
nawk '/^#/ {next} FNR==NR {prd;next} !($0 in prd)'
So, this is what i did
fname=prd // unix shell variable
nawk -v fname=$fname '/^#/ {next} FNR==NR {fname;next} !($0 in fname)'But the value of fname i.e "prd" is not... (8 Replies)
Discussion started by: mohtashims
8 Replies
2. Shell Programming and Scripting
#ifconfig -a | nawk '/1.1.1.1/{print}'
inet 1.1.1.1 netmask xxxxxxxxx broadcast 0.0.0.0
If i assign the ip to a variable and search for the variable nothing gets printed!!
# ifconfig -a | nawk -v ip=1.1.1.1 '/ip/{print}'
I am not able to understand why this is happening! (6 Replies)
Discussion started by: chidori
6 Replies
3. Shell Programming and Scripting
Hello,
I have external variable rownumber, I am processing files within a loop and I would like to keep incrementing rownumber. What is happening is inside nawk section it passes rownumber but it never gets updated. I want to update rownumber inside the nawk, I would appreciate your help
... (6 Replies)
Discussion started by: srattani
6 Replies
4. Shell Programming and Scripting
Hi guys
I am using the following command to "grep" a pattern and 22 lines after it from the file:
$ nawk '/\/{c=22}c&&c--' allocations.ini
It does the job fine if the pattern is hardcoded into the command, if the case above it is .
But when I am trying to assign a variable instead of... (7 Replies)
Discussion started by: aoussenko
7 Replies
5. Shell Programming and Scripting
I'm trying the following script using nawk and failed to call variable inside the script.
echo "Enter the absolute path of XML location for respective billcycle"
read xml_location
grep "string to find:" abcd.log|cut -d '/' -f12|nawk '{print $xml_location $1}' > redirected_log.log
Please... (2 Replies)
Discussion started by: nadvi
2 Replies
6. Solaris
Hi,
new to nawk so not sure how this works,
I have a file with three values 23:36:18 - i need to set a variable called SCORE with the highest value from the file (i.e. 36) using nawk
can anyone help?
thanks (1 Reply)
Discussion started by: Pablo_beezo
1 Replies
7. Shell Programming and Scripting
I am trying to make a simple script in which i take input from shell and then forward the value to
nawk (BEGIN).
but when i run below mention script so it give no output.
echo "Enter TRUNK GROUP:"
read TGR
cat /omp-data/logs/5etr/080422.APX | nawk -F"|" -v P=$TGR '
BEGIN {
TG=P;... (1 Reply)
Discussion started by: wakhan
1 Replies
8. Shell Programming and Scripting
I am trying to write the following c code in nawk:
while ((ch = getc (fp)) != EOF)
{
total_bytes++;
checksum = (checksum >> 1) + ((checksum & 1) << 15);
checksum += ch;
checksum &= 0xffff; /* Keep it within bounds. */
}
I appreciate your help (10 Replies)
Discussion started by: DeltaX
10 Replies
9. Shell Programming and Scripting
Hello everybody !!
I just started messing around with NAWK/AWK and I find it very interesting. I was trying to have script that prints only the the different lines (lines that are identical and adjacent, some that are identical and not adjacent, and some that are just different)
I tried... (6 Replies)
Discussion started by: DeltaX
6 Replies
10. UNIX for Dummies Questions & Answers
After searching through books and the internet for days I can't seem to find an example of this.
I'm trying to pass a variable from a for loop into nawk but can't seem to get all the syntax right.
my script (thanks to anbu23 for nawk help) is this:
for customers in `cat customers.txt`
do... (3 Replies)
Discussion started by: Ant1815
3 Replies