Sponsored Content
Full Discussion: Null metacharacter?
Top Forums Shell Programming and Scripting Null metacharacter? Post 97059 by jim mcnamara on Wednesday 25th of January 2006 03:59:30 PM
Old 01-25-2006
I'm not sure why you think you need this, ASCII NUL is the end of a string. The dirent struct member d_name is a char *. So it will be interpreted as ending with the character before the NUL.

the null character is
Code:
\000

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

compare null with non-null

I've got a very peculiar situation. I'm trying to find out if we can compare null fields with non-null. I've output csv files from SQL and Oracle. I need to compare each field from the files, and then find out any differences. The files usualy have over 500 fields, and send the resule to DBA.... (8 Replies)
Discussion started by: nitin
8 Replies

2. Shell Programming and Scripting

read metacharacter [ and ]

i have command sed sed '/^*$/ d' which don't recognize the how can i solve it? (2 Replies)
Discussion started by: kamel.seg
2 Replies

3. Shell Programming and Scripting

how to use scp with metacharacter

hi i have a file name : file^name that i need to scp to different machine without changing the name scp file^name user@machine/file^name its throwing the error cant use ^name(Something like this) any solution i already tried differnt combinations like "user@machine/file^name"... (2 Replies)
Discussion started by: narang.mohit
2 Replies

4. 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

5. Shell Programming and Scripting

grep'ing a variable that contains a metacharacter ($) with a while loop

This is driving me crazy, and I'm hoping someone can help me out with this. I'm trying to do a simple while loop to go through a log file. I'm pulling out all of the lines with a specific log line, getting an ID from that line, and once I have a list of IDs I want to loop back through the log and... (2 Replies)
Discussion started by: DeCoTwc
2 Replies

6. UNIX for Dummies Questions & Answers

/dev/null 2>&1 Versus /dev/null 2>1

How are these two different? They both prevent output and error from being displayed. I don't see the use of the "&" echo "hello" > /dev/null 2>&1 echo "hello" > /dev/null 2>1 (3 Replies)
Discussion started by: glev2005
3 Replies

7. Shell Programming and Scripting

How to remove metacharacter while using wget command

Hi All, While using below command I am getting some unusual character in Release.txt file.How could I remove or stop them to go into Release.txt file wget -q http://m0010v.prod.wspan.com/nggfmonatl/Default.aspx cat Default.aspx|egrep -in "EFS|HOTFIX" | awk -F/ '{print $(NF-1)}'|cut -d... (1 Reply)
Discussion started by: anuragpgtgerman
1 Replies

8. Shell Programming and Scripting

Redirecting standard out to /dev/null goes to file "/dev/null" instead

I apologize if this question has been answered else where or is too elementary. I ran across a KSH script (long unimportant story) that does this: if ; then CAS_SRC_LOG="/var/log/cas_src.log 2>&1" else CAS_SRC_LOG="/dev/null 2>&1" fithen does this: /usr/bin/echo "heartbeat:... (5 Replies)
Discussion started by: jbmorrisonjr
5 Replies

9. Homework & Coursework Questions

metacharacter

how to list all filenames consisting of two lower case letters using metacharacters? (1 Reply)
Discussion started by: rathankumar
1 Replies

10. UNIX for Beginners Questions & Answers

Find command with Metacharacter (*) Should match exact filename

Hi, Below is list of files in my directory. -rw-rw-r--. 1 Roots Roots 0 Dec 26 06:58 12345_kms_report.csv -rw-rw-r--. 1 Roots Roots 0 Dec 26 06:59 12346_kms_report.csv -rw-rw-r--. 1 Roots Roots 0 Dec 26 06:59 12347_kms_report.csv -rw-rw-r--. 1 Roots Roots 0 Dec 26 06:59... (2 Replies)
Discussion started by: Balraj
2 Replies
DIRENT(3)						   BSD Library Functions Manual 						 DIRENT(3)

NAME
dirent -- directory format SYNOPSIS
#include <sys/types.h> #include <sys/dirent.h> mode DTTOIF(dirtype); dirtype IFTODT(mode); DESCRIPTION
Directories provide a convenient hierarchical method of grouping files while obscuring the underlying details of the storage medium. A directory file is differentiated from a plain file by a flag in its inode(5) entry. It consists of records (directory entries) each of which contains information about a file and a pointer to the file itself. Directory entries may contain other directories as well as plain files; such nested directories are referred to as subdirectories. A hierarchy of directories and files is formed in this manner and is called a file system (or referred to as a file system tree). Each directory file contains two special directory entries; one is a pointer to the directory itself called dot '.' and the other a pointer to its parent directory called dot-dot '..'. Dot and dot-dot are valid pathnames, however, the system root directory '/', has no parent and dot-dot points to itself like dot. File system nodes are ordinary directory files on which has been grafted a file system object, such as a physical disk or a partitioned area of such a disk. (See mount(8).) IMPLEMENTATION NOTES
The directory entry format is defined in the file <sys/dirent.h>, which is also included by <dirent.h>. The format is represented by the dirent structure, which contains the following entries: ino_t d_fileno; uint16_t d_reclen; uint16_t d_namlen; uint8_t d_type; char d_name[MAXNAMLEN + 1]; These are: 1. The d_fileno entry is a number which is unique for each distinct file in the filesystem. Files that are linked by hard links (see link(2)) have the same d_fileno. If d_fileno is zero, the entry refers to a deleted file. The type ino_t is defined in <sys/types.h>. 2. The d_reclen entry is the length, in bytes, of the directory record. 3. The d_namlen entry specifies the length of the file name excluding the NUL. Thus the actual size of d_name may vary from 1 to MAXNAMLEN + 1. 4. The d_type is the type of the file. 5. The d_name entry contains a NUL-terminated file name. The following table lists the types available for d_type and the corresponding ones used in the struct stat (see stat(2)), respectively: Dirent Stat Description DT_UNKNOWN - unknown file type DT_FIFO S_IFIFO named pipe DT_CHR S_IFCHR character device DT_DIR S_IFDIR directory DT_BLK S_IFBLK block device DT_REG S_IFREG regular file DT_LNK S_IFLNK symbolic link DT_SOCK S_IFSOCK UNIX domain socket DT_WHT S_IFWHT dummy ``whiteout inode'' The DT_WHT type is internal to the implementation and should not be seen in normal user applications. The macros DTTOIF() and IFTODT() can be used to convert from struct dirent types to struct stat types, and vice versa. COMPATIBILITY
The IEEE Std 1003.1-2001 (``POSIX.1'') standard specifies only the fields d_ino and d_name. The remaining fields are available on many, but not all systems. Furthermore, the standard leaves the size of d_name as unspecified, mentioning only that the number of bytes preceding the terminating NUL shall not exceed NAME_MAX. Because of this, and because the d_namlen field may not be present, a portable application should determine the size of d_name by using strlen(3) instead of applying the sizeof() operator. SEE ALSO
getdents(2), fs(5), inode(5) HISTORY
A dir structure appeared in Version 7 AT&T UNIX. The dirent structure appeared in NetBSD 1.3. BSD
May 16, 2010 BSD
All times are GMT -4. The time now is 09:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy