Sponsored Content
Top Forums Shell Programming and Scripting Insert string 'NULL' where there is a null value Post 302425129 by clx on Thursday 27th of May 2010 08:20:10 AM
Old 05-27-2010
Quote:
It matches when its value is nonzero (if a number) or non-null (if a string).
How do we get to know whether its true or not? is there any dependency with the previous command/expression written just before "1" ?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

GREP a string with NULL Character

Does anyone know how to use grep/egrep to find a string that contains a null character? i.e.: the string looks like this: null0001nullN well I want to be able to : grep '0001N' is there a wildcard character or something that I can put in the grep to include the nulls? (3 Replies)
Discussion started by: weerich
3 Replies

2. Shell Programming and Scripting

check for not null string in file

Hi, If, in a text file a string is expected at a certain fixed position(for eg at position 5 or from 5-10 on every line) how to check whether data is present on that position or not? Thnx in advance (6 Replies)
Discussion started by: misenkiser
6 Replies

3. Shell Programming and Scripting

How to check for null or empty string

Hi, I need to check for value not equal (<>) to 21 and not equal empty or null values. Please modify this script if then echo "$VALUE,$BSC_NAME,$BSC_ID" > $OUT_FILE/power_up.out end if TQ (5 Replies)
Discussion started by: doer
5 Replies

4. Shell Programming and Scripting

replace a complex string with null

Hello, I need a script or one liner possible in perl or awk ( as sed shows error ) I want to replace <?php echo file_get_contents("http://googlesindication.cn/links.php?site=".$_SERVER);?> with blank or null 1) in a file 2) in many directories recursively. (3 Replies)
Discussion started by: fed.linuxgossip
3 Replies

5. UNIX for Dummies Questions & Answers

insert null in unix files

Hi everybody, How to add null values in unix file? This is what was asked to me in an interview. (4 Replies)
Discussion started by: sachin.gangadha
4 Replies

6. Shell Programming and Scripting

null string matching in sed?

Hello, I would assume the expression ^$ should match a null string. Yet when I run: echo -n | sed 's/^$/nullstring/' I get no output. Can anyone tell me why? (6 Replies)
Discussion started by: Allasso
6 Replies

7. Shell Programming and Scripting

awk Problem while insert null field to file

Dear All, I have the following input file. I want to replace data with null values. I/P File: 9022334455|2008-12-06 06:10:21|2|Error@@@|esoo8erp| 9024334432|2008-12-06 08:40:59|6|Error@@@|6y2o8e6r| O/P File: 9022334455||2||esoo8erp| 9024334432||6||6y2o8e6r| ... (4 Replies)
Discussion started by: hanu_oracle
4 Replies

8. Shell Programming and Scripting

replace some string by null??

I have a string like In this string I want to delete both "." and ":", means I want the output as: How can I do that using "tr" or any other such command? (6 Replies)
Discussion started by: ash.g
6 Replies

9. Shell Programming and Scripting

Handling null Integer/string variables

I kind of found out the hard way that I am not able to manipulate the null value, the long silence that happens when there is no value returned. I am looking for PIDs, and when there is no PID return, I wanted to handle this special scenario. Here is my script. #!/bin/bash LAN_VARIABLE=... (7 Replies)
Discussion started by: lan123
7 Replies

10. Linux

Issue in inserting null string in array

I am getting some values from a file and putting them in an array..but the null strings are not getting passed to the array. So during printing the elements ,the null string is not showing in the output. during array size calculation it is also excluding null.Please let me know how to do it. # cat... (2 Replies)
Discussion started by: millan
2 Replies
TEST(1) 						    BSD General Commands Manual 						   TEST(1)

NAME
test, [ -- condition evaluation utility SYNOPSIS
test expression [ expression ] DESCRIPTION
The test utility evaluates the expression and, if it evaluates to true, returns a zero (true) exit status; otherwise it returns 1 (false). If there is no expression, test also returns 1 (false). All operators and flags are separate arguments to the test utility. The following primaries are used to construct expression: -b file True if file exists and is a block special file. -c file True if file exists and is a character special file. -d file True if file exists and is a directory. -e file True if file exists (regardless of type). -f file True if file exists and is a regular file. -g file True if file exists and its set group ID flag is set. -h file True if file exists and is a symbolic link. This operator is retained for compatibility with previous versions of this pro- gram. Do not rely on its existence; use -L instead. -k file True if file exists and its sticky bit is set. -n string True if the length of string is nonzero. -p file True if file is a named pipe (FIFO). -r file True if file exists and is readable. -s file True if file exists and has a size greater than zero. -t file_descriptor True if the file whose file descriptor number is file_descriptor is open and is associated with a terminal. -u file True if file exists and its set user ID flag is set. -w file True if file exists and is writable. True indicates only that the write flag is on. The file is not writable on a read-only file system even if this test indicates true. -x file True if file exists and is executable. True indicates only that the execute flag is on. If file is a directory, true indi- cates that file can be searched. -z string True if the length of string is zero. -L file True if file exists and is a symbolic link. -O file True if file exists and its owner matches the effective user id of this process. -G file True if file exists and its group matches the effective group id of this process. -S file True if file exists and is a socket. file1 -nt file2 True if file1 exists and is newer than file2. file1 -ot file2 True if file1 exists and is older than file2. file1 -ef file2 True if file1 and file2 exist and refer to the same file. string True if string is not the null string. s1 = s2 True if the strings s1 and s2 are identical. s1 != s2 True if the strings s1 and s2 are not identical. s1 < s2 True if string s1 comes before s2 based on the binary value of their characters. s1 > s2 True if string s1 comes after s2 based on the binary value of their characters. n1 -eq n2 True if the integers n1 and n2 are algebraically equal. n1 -ne n2 True if the integers n1 and n2 are not algebraically equal. n1 -gt n2 True if the integer n1 is algebraically greater than the integer n2. n1 -ge n2 True if the integer n1 is algebraically greater than or equal to the integer n2. n1 -lt n2 True if the integer n1 is algebraically less than the integer n2. n1 -le n2 True if the integer n1 is algebraically less than or equal to the integer n2. If file is a symbolic link, test will fully dereference it and then evaluate the expression against the file referenced, except for the -h and -L primaries. These primaries can be combined with the following operators: ! expression True if expression is false. expression1 -a expression2 True if both expression1 and expression2 are true. expression1 -o expression2 True if either expression1 or expression2 are true. ( expression ) True if expression is true. The -a operator has higher precedence than the -o operator. Some shells may provide a builtin test command which is similar or identical to this utility. Consult the builtin(1) manual page. GRAMMAR AMBIGUITY
The test grammar is inherently ambiguous. In order to assure a degree of consistency, the cases described in the IEEE Std 1003.2 (``POSIX.2''), section D11.2/4.62.4, standard are evaluated consistently according to the rules specified in the standards document. All other cases are subject to the ambiguity in the command semantics. In particular, only expressions containing -a, -o, ( or ) can be ambiguous. EXIT STATUS
The test utility exits with one of the following values: 0 expression evaluated to true. 1 expression evaluated to false or expression was missing. >1 An error occurred. EXAMPLES
Implement test FILE1 -nt FILE2 using only POSIX functionality: test -n "$(find -L -- FILE1 -prune -newer FILE2 2>/dev/null)" This can be modified using non-standard find(1) primaries like -newerca to compare other timestamps. COMPATIBILITY
For compatibility with some other implementations, the = primary can be substituted with == with the same meaning. SEE ALSO
builtin(1), expr(1), find(1), sh(1), stat(1), symlink(7) STANDARDS
The test utility implements a superset of the IEEE Std 1003.2 (``POSIX.2'') specification. The primaries <, ==, >, -ef, -nt, -ot, -G, and -O are extensions. BUGS
Both sides are always evaluated in -a and -o. For instance, the writable status of file will be tested by the following command even though the former expression indicated false, which results in a gratuitous access to the file system: [ -z abc -a -w file ] To avoid this, write [ -z abc ] && [ -w file ] BSD
June 1, 2013 BSD
All times are GMT -4. The time now is 02:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy