caused the array T to be filled with many null values. At the beginning, length(T) was 6. When i was incremented to 4, it created new array element T[4], etc.
In AWK, arrays are associative and array subscripts are always strings. Arrays can be sparse as in your example. If you use an array subscript (expression index) to refer to an array element that has no recorded value, i.e. T[10], then the value returned is "", the null string.
You can test whether a particular index exists, without the side effect of creating that element if it is not already present by using an
expression.
For more information, see Chapter 11 of Effective AWK Programming by Arnold Robbins.
Hi there,
I have a very general question. I'm rather new to (bash) shell scripting and I don't understand how conditions work... I've read numerous tutorials but I don't get it. I really don't. Sometime what I do works, sometime it doesn't and that's frustating. So what's the actual difference... (0 Replies)
this is my program i am trying to compile
/* filedata -- display information about a file */
#include <stdlib.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
/*
* use octarray for determing
* if permission bits set
*/
static short octarray = {0400, 0200, 0100,... (2 Replies)
I'm just trying to confirm that I understand someone's code correctly.
If someone has code that says:
$foo ||= mysub();
I'm assuming that it means if $foo is nothing or undef, then assign it some value via mysub(). If I'm wrong on this, please let me know.
Also, what's the difference... (4 Replies)
I have a text file called file1 which contains the text: "ls -l"
When I enter this command:
bash < file1 > file1
file1 gets erased. However if I enter this command:
bash < file1 > newfile
the output from "ls -l" is stored in newfile. My question is why doesn't file1's text ("ls -l") get... (3 Replies)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
1)find all lines in file ,myf that contain all the words cat dog and mouse in any order and start with the letter... (1 Reply)
I learn using RS in awk to extract portion of file in this forum which is wonderful solution to the problem. However, I don't understand how exactly it operates.
I don't quite understand the mechanism behind how searching for /DATA2/ can result in extracting the whole section under "DATA2"
... (3 Replies)
Hi all.
The startup script in /usr/local/bin.
After user login the script run an application.
Iwould in the same way run the another application.
How to make It similar?
Where I must to look?
Regards. (3 Replies)
if {"$my_ext_type" = MAIN]; then
cd $v_sc_dir
Filex.SH $v_so_dir\/$v_fr_file
Can somebody tell me what does this suggest. I am pretty new to unix and
I am getting confused.
What i understood from here is
If we have a file extension name as MAIN
which we have then we change the directory to... (1 Reply)