11-03-2019
"True" to all except for a "partial True" for the fourth questiion - in string context, the value of an undefined / uninitialized / unassigned element is "", i.e. the empty string.
Last edited by RudiC; 11-03-2019 at 05:16 PM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
How can find Array is NULL or not.
i wrote script using arrays but i want dislpy an message if arrary was Empty.
pls help me on this. (2 Replies)
Discussion started by: koti_rama
2 Replies
2. Shell Programming and Scripting
I have a raw data file:
70,1,1,-53.25
70,1,1,,,,-57.50
70,1,1,,,,,,,,,,-48.00
I want to have a output file with the formatting below:
70,1,1,-53.25,,,,-57.50,,,,,-48.00
I mean if these rows have the first similar three variables which will be group into one row. And I try to write a... (1 Reply)
Discussion started by: anhtt
1 Replies
3. Shell Programming and Scripting
Dear Experts,
I have a file containing text like below
123
456
789
012
345
I want to save each line in array.
and print each array index as per my requirement.
For Example array will print 456
array will print 012
Thanks for your Help. (14 Replies)
Discussion started by: Danish Shakil
14 Replies
4. Shell Programming and Scripting
Hi all,
i have a data array as follows.
array=ertfgj2345
array=456ttygkd
.
.
.
array=errdjt3235
so number or elements in the array can varies depending on how big the data input is.
now i have a variable, and it is $1 (there are $2, $3 and so on, i am only interested in $1).
... (9 Replies)
Discussion started by: usustarr
9 Replies
5. Shell Programming and Scripting
Hi I am trying to get data from an array and input it into awk. Please see below:
###
#!/bin/bash
#declare array
declare -a ARRAY
exec 10</path/to/arrayfile
let count=0
while read LINE <&10; do
ARRAY=$LINE
((count++))
done
#close file
exec 10>&-
ENDLOOP=0 (10 Replies)
Discussion started by: rocket_dog
10 Replies
6. Shell Programming and Scripting
hi,
can somebody explain me this?
probably i am overlooking something but i dont know what
why is not printed "7 9 11" instead of this?
$ echo "" | awk '{for(i=1;i<=3;i++){j=7;a=j;j=j+2;} print a,a,a; }'
7 7 7thanks (2 Replies)
Discussion started by: erik80
2 Replies
7. Shell Programming and Scripting
Hello experts,
I'm stuck with this script for three days now. Here's what i need.
I need to split a large delimited (,) file into 2 files based on the value present in the last field.
Samp: Something.csv
bca,adc,asdf,123,12C
bca,adc,asdf,123,13C
def,adc,asdf,123,12A
I need this split... (6 Replies)
Discussion started by: shell_boy23
6 Replies
8. Shell Programming and Scripting
I'm trying to get the output from awk into a bash array. Here is my script.
#!/bin/bash
while :
do
app=$( osascript -e "tell application \"System Events\" to return name of every process whose frontmost is true" )
echo "$app"
if ava ]]
then
ps -ax | grep -v awk | pids=( $(awk... (5 Replies)
Discussion started by: nextyoyoma
5 Replies
9. Shell Programming and Scripting
Hello All,
Can you please help me with the below.
#!/bin/bash
ARR="No Differences In Stage Between HASH_TOTALS & HASH_TOTALS_COMP For UNINUM:0722075 PROVIDER:5 EXTRACT_DT:30-SEP-12 VER_NUM:1"
ARR="No Differences In Stage Between HASH_TOTALS & HASH_TOTALS_COMP For UNINUM:0722075 PROVIDER:5... (14 Replies)
Discussion started by: Ariean
14 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
TEST(1) General Commands Manual TEST(1)
NAME
test - set status according to condition
SYNOPSIS
test expr
DESCRIPTION
Test evaluates the expression expr. If the value is true the exit status is null; otherwise the exit status is non-null. If there are no
arguments the exit status is non-null.
The following primitives are used to construct expr.
-r file True if the file exists (is accessible) and is readable.
-w file True if the file exists and is writable.
-x file True if the file exists and has execute permission.
-e file True if the file exists.
-f file True if the file exists and is a plain file.
-d file True if the file exists and is a directory.
-s file True if the file exists and has a size greater than zero.
-t fildes True if the open file whose file descriptor number is fildes (1 by default) is the same file as /dev/cons.
s1 = s2 True if the strings s1 and s2 are identical.
s1 != s2 True if the strings s1 and s2 are not identical.
s1 True if s1 is not the null string. (Deprecated.)
-n s1 True if the length of string s1 is non-zero.
-z s1 True if the length of string s1 is zero.
n1 -eq n2 True if the integers n1 and n2 are arithmetically equal. Any of the comparisons -ne, -gt, -ge, -lt, or -le may be used in place
of -eq. The (nonstandard) construct -l string, meaning the length of string, may be used in place of an integer.
These primaries may be combined with the following operators:
! unary negation operator
-o binary or operator
-a binary and operator; higher precedence than -o
( expr ) parentheses for grouping.
The primitives -b, -u, -g, and -s return false; they are recognized for compatibility with POSIX.
Notice that all the operators and flags are separate arguments to test. Notice also that parentheses and equal signs are meaningful to rc
and must be enclosed in quotes.
EXAMPLES
Test is a dubious way to check for specific character strings: it uses a process to do what an rc(1) match or switch statement can do. The
first example is not only inefficient but wrong, because test understands the purported string "-c" as an option.
if (test $1 '=' "-c") echo OK # wrong!
A better way is
if (~ $1 -c) echo OK
Test whether is in the current directory.
test -f abc -o -d abc
SOURCE
/sys/src/cmd/test.c
SEE ALSO
rc(1)
TEST(1)