Sponsored Content
Operating Systems Linux Issue in inserting null string in array Post 302988562 by RudiC on Wednesday 28th of December 2016 08:18:35 AM
Old 12-28-2016
PLEASE DON'T modify posts if people have already answered, pulling the rug from under their feet!

On a vague specification without decent sample input and output data and detailed error description, you can expect very generic replies only:
- How do you tell "null strings" from normal fields - two adjacent field separators?
- What are the field separators - you seem to use awk's default?
- What is the purpose of the piped second awk command, why don't you do that in the first?
- Why do you gsub the entire line in every field's loop?
- Are you aware that the shell concatenates ALL whitespace into one space unless quoted? So, "null strings" might be lost here...

Last edited by RudiC; 12-29-2016 at 06:02 AM.. Reason: typo
This User Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Has anyone seen this issue with the /dev/null?

hello all, I am working in a Hpux 11.0 64 bit environment. I am not sure if a third party software is doing this or not, but the admin to this server says it is not a server issue as he has check and double check logs and crons to verify this issue. My problem, is that every now and then, once... (4 Replies)
Discussion started by: oott
4 Replies

2. Shell Programming and Scripting

PHP: how can I delete empty/NULL elements from a multi-dimensional array.

Hi all I have a file that i'm running and exec(cat ./dat) against..and putting its contents into any array, then doing an exploding the array into a multi-dimension array... The 15 multi-dimensional arrays have elements that are null/empty, I would like to remove/unset these elements and then... (2 Replies)
Discussion started by: zeekblack
2 Replies

3. Shell Programming and Scripting

Insert string 'NULL' where there is a null value

I have an input file having 7 fields delimited by , eg : 1,ABC,hg,1,2,34,3 2,hj,YU,2,3,4, 3,JU,kl,4,5,7, 4,JK,KJ,3,56,4,5 The seventh field here in some lines is empty, whereas the other lines there is a value. How do I insert string NULL at this location (7th loc) for these lines where... (8 Replies)
Discussion started by: zilch
8 Replies

4. Shell Programming and Scripting

Inserting a string in another sting

Hi Experts, I need to insert a sting into another string at a specified position. Like the below. Regards, Tin-Tin (3 Replies)
Discussion started by: tinufarid
3 Replies

5. Programming

Checking an array for NULL in C++

Hello All, I have this question that how to check for an array for NULL? For eg. #include<iostream.h> using namespace std; int main() { char arr; if(arr == NULL) { cout<<"NULL"; } } Thanks a lott in advance!!! (3 Replies)
Discussion started by: mind@work
3 Replies

6. Shell Programming and Scripting

PERL : Read an array and write to another array with intial string pattern checks

I have an array and two variables as below, I need to check if $datevar is present in $filename. If so, i need to replace $filename with the values in the array. I need the output inside an ARRAY How can this be done. Any help will be appreciated. Thanks in advance. (2 Replies)
Discussion started by: irudayaraj
2 Replies

7. Shell Programming and Scripting

Issue with null value

Hi, I am trying below code. let me explain what is going on here. xmitq=`echo "dis qr($queue) xmitq"|runmqsc $QMGR| tr ' ' '\n' | sed 's/^*//g'|grep "XMITQ"| cut -d '(' -f2| cut -d ')' -f1` chl=`echo "dis chl(*) xmitq"| runmqsc $QMGR |egrep 'CHANNEL|XMITQ'|\ egrep -v... (6 Replies)
Discussion started by: darling
6 Replies

8. Shell Programming and Scripting

working with null elements in an array

i have an array (with each element length "n") which is dynamic and has alphanumeric characters. i want to check if any of the elements of the array are null and replace it with a string of "n" zeros for that element. can you suggest me a code for the same. (1 Reply)
Discussion started by: mumbaiguy07
1 Replies

9. AIX

/dev/null file issue

Hi Experts, I Have a query. In one of my server I just came to know that there was /dev/null file which is a not a character file. Its just a normal file. I know the command to create the character file (/dev/null) but what is the procedure. Like should i delete /dev/null and create or... (7 Replies)
Discussion started by: jayadeava
7 Replies

10. Shell Programming and Scripting

Finding null column value using array

hi, Am trying to find a solution for finding a null column value inside a loop using array. for eg: two three five From the above array myarray,myarray and myarray having null values. But when am trying to check that space using some condition its not working. for (( i=0;... (4 Replies)
Discussion started by: rogerben
4 Replies
cuserid(3C)						   Standard C Library Functions 					       cuserid(3C)

NAME
cuserid - get character login name of the user SYNOPSIS
#include <stdio.h> char *cuserid(char *s); DESCRIPTION
The cuserid() function generates a character-string representation of the login name under which the owner of the current process is logged in. If s is a null pointer, this representation is generated in an internal static area whose address is returned. Otherwise, s is assumed to point to an array of at least L_cuserid characters; the representation is left in this array. The constant L_cuserid is defined in the <stdio.h> header. In multithreaded applications, the caller must always supply an array s for the return value. RETURN VALUES
If the login name cannot be found, cuserid() returns a null pointer. If s is not a null pointer, the null character `' will be placed at s[0]. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
getlogin(3C), getpwnam(3C), attributes(5) SunOS 5.11 30 Dec 1996 cuserid(3C)
All times are GMT -4. The time now is 11:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy