05-07-2012
It uses nr[$1], which is $NF of the last line. What are you trying to achieve?
--
As an aside: $1 happens to be available because your particular awk retains that value in the END section. With some awks this value will be "", since the field variable are only available in the middle section.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi experts,
I have a the following awk command,
awk '{print $1}' /users/jon/list4.txt. The output is
123
787
888
...
...
I want to move the output to array using shell programming.
My shell is tcsh.
Is it possible to move to array using shell porg? I know its possible in... (14 Replies)
Discussion started by: amitrajvarma
14 Replies
2. Shell Programming and Scripting
Hi,
I have a file
1:apple orange:one
2:banana:two
3:cherry:3
When I do awk -F: ' { print $2 } ' file
apple orange
banana
cherry
Now, when i redirect awk output to the file it has issue with strings
#!/bin/bash
FILEA=file
A=(`awk -F: ' { print $2 } ' $FILEA `)
echo ${A} (2 Replies)
Discussion started by: phamp008
2 Replies
3. Shell Programming and Scripting
Hi everyone:)
I have 2 files - IN & OUT. Example:
IN
A:13:30
B:45:40
.
.
. UNLIMITED
OUT
Z:12:24
Y:20:15
.
.
. UNLIMITED
I want first row of numbers of IN - OUT. Example 13-12 45-20
My code is (2 Replies)
Discussion started by: vincyoxy
2 Replies
4. UNIX for Dummies Questions & Answers
I'm guessing i have a syntax error. I'm not sure it get's past the the while condition. I get an error 0 not found. Simple loop not sure what I'm doing wrong.
#!/usr/bin/ksh
set -A MtPtArray /u03 /u06
tUbound=${#MtPtArray
}
echo $tUbound
i=0
while ($i -lt $tUbound)
do
print... (4 Replies)
Discussion started by: KME
4 Replies
5. Shell Programming and Scripting
Hi all,
I have a script which produces a nice table but I want to sort it on column 3.
This is the output line in the script:
# Output
{ FS = ":";
format = "%11s %6s %-16s\n";
prinft "\n"
printf ( format, "Size","Count","Who" ) }
for (i in... (21 Replies)
Discussion started by: Cowardly
21 Replies
6. Shell Programming and Scripting
This code works perfect when using a machine with only one interface online. (Excluding the loopback of course) But when I have other interface up for vmware or a vpn the output gets mixed up. I know I had this working when I was just reading ip's from files so I know it is not a problem with... (8 Replies)
Discussion started by: Azrael
8 Replies
7. Shell Programming and Scripting
I have this code
echo $logfile | awk ' {arr++; next} END { for (i in arr) {print i} }'
that gives me this output
result1
result2
result3
I try to figure out how to get it like this
result1 result2 result3 (4 Replies)
Discussion started by: Jotne
4 Replies
8. Shell Programming and Scripting
I need help to sort the output of an awk array
Example datadata="1 blue
2 green
3 blue
4 yellow
5 blue
6 red
7 yellow
8 red
9 yellow
10 yellow
11 green
12 orange
13 black"
My awk line to get output in one lineecho "$data" | awk ' {arr++; next} END { for (i in arr) { if(arr>1 )... (2 Replies)
Discussion started by: Jotne
2 Replies
9. Shell Programming and Scripting
I have a large file where I want to extract the data by using awk script. I have made a small sample of the input data. I have in the awk script two condition . The first one is to collect the initial time and the second one to collect the end time. I stored the difference between (Time=end-start)... (8 Replies)
Discussion started by: ENG_MOHD
8 Replies
10. Shell Programming and Scripting
Here's my code:
awk -F '' 'NR==FNR {
if (/time/ && $5>10)
A=$2" "$3":"$4":"($5-01)
else if (/time/ && $5<01)
A=$2" "$3":"$4-01":"(59-$5)
else if (/time/ && $5<=10)
A=$2" "$3":"$4":0"($5-01)
else if (/close/) {
B=0
n1=n2;
... (2 Replies)
Discussion started by: klane
2 Replies
scnhdr(4) Kernel Interfaces Manual scnhdr(4)
NAME
scnhdr - Section header for an object file
SYNOPSIS
#include <scnhdr.h>
DESCRIPTION
Every object file has a group of section headers to specify the layout of the data within the file. Each section within an object file has
its own header. The C structure is as follows:
struct scnhdr {
char s_name[8]; /* section name */
long s_paddr; /* physical address, aliased s_nlib */
long s_vaddr; /* virtual address */
long s_size; /* section size */
long s_scnptr; /* file ptr to raw data for section */
long s_relptr; /* file ptr to relocation */
long s_lnnoptr; /* special purpose */
unsigned short s_nreloc; /* number of reloc entries */
unsigned short s_nlnno; /* unused */
int s_flags; /* flags */ };
File pointers are byte offsets into the file; they can be used as the offset in a call to FSEEK (see ldfcn(4)). If a section is initial-
ized, the file contains the actual bytes. An uninitialized section is somewhat different. It has a size, symbols defined in it, and sym-
bols that refer to it. But it can have no relocation entries or data. Consequently, an uninitialized section has no raw data in the
object file, and the values for s_scnptr, s_relptr, and s_nreloc are zero.
The entries that refer to line numbers (s_lnnoptr, and s_nlnno) are not related to line number information. See the header file sym.h for
the entries to get to the line number table. The entries that were for line numbers are reserved and should be set to zero.
The number of relocation entries for a section is found in the s_nreloc field of the section header. Being a `C' language short, this field
can overflow with large objects. If this field overflows, the section header s_flags field has the SM S_NRELOC_OVFL bit set. In this
case, the true number of relocation entries is found in the r_vaddr field of the first relocation entry for that section. That relocation
entry has a type of SM R_ABS, so it is ignored when the relocation takes place.
RELATED INFORMATION
ld(1), fseek(3), a.out(4), reloc(4). delim off
scnhdr(4)