DUP(3) Library Functions Manual DUP(3)NAME
dup - dups of open files
SYNOPSIS
bind #d /fd
/fd/0
/fd/1
...
DESCRIPTION
The dup device serves a one-level directory containing files whose names are decimal numbers. A file of name n corresponds to open file
descriptor n in the current process.
An open(2) of file n results in a file descriptor identical to what would be returned from a system call dup(n, -1). Note that the result
is no longer a file in the dup device.
The stat operation returns information about the device file, not the open file it points to. A stat of #d/n will contain n for the name,
0 for the length, and 0400, 0200, or 0600 for the mode, depending on whether the dup target is open for reading, writing, or both.
SEE ALSO dup(2)SOURCE
/sys/src/9/port/devdup.c
DUP(3)
Check Out this Related Man Page
DUP(2) BSD System Calls Manual DUP(2)NAME
dup, dup2 -- duplicate an existing file descriptor
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <unistd.h>
int
dup(int oldd);
int
dup2(int oldd, int newd);
DESCRIPTION
The dup() system call duplicates an existing object descriptor and returns its value to the calling process (newd = dup(oldd)). The argument
oldd is a small non-negative integer index in the per-process descriptor table. The new descriptor returned by the call is the lowest num-
bered descriptor currently not in use by the process.
The object referenced by the descriptor does not distinguish between oldd and newd in any way. Thus if newd and oldd are duplicate refer-
ences to an open file, read(2), write(2) and lseek(2) calls all move a single pointer into the file, and append mode, non-blocking I/O and
asynchronous I/O options are shared between the references. If a separate pointer into the file is desired, a different object reference to
the file must be obtained by issuing an additional open(2) system call. The close-on-exec flag on the new file descriptor is unset.
In dup2(), the value of the new descriptor newd is specified. If this descriptor is already in use and oldd != newd, the descriptor is first
deallocated as if the close(2) system call had been used. If oldd is not a valid descriptor, then newd is not closed. If oldd == newd and
oldd is a valid descriptor, then dup2() is successful, and does nothing.
RETURN VALUES
These calls return the new file descriptor if successful; otherwise the value -1 is returned and the external variable errno is set to indi-
cate the cause of the error.
ERRORS
The dup() system call fails if:
[EBADF] The oldd argument is not a valid active descriptor
[EMFILE] Too many descriptors are active.
The dup2() system call fails if:
[EBADF] The oldd argument is not a valid active descriptor or the newd argument is negative or exceeds the maximum allowable
descriptor number
SEE ALSO accept(2), close(2), fcntl(2), getdtablesize(2), open(2), pipe(2), socket(2), socketpair(2), dup3(3)STANDARDS
The dup() and dup2() system calls are expected to conform to ISO/IEC 9945-1:1990 (``POSIX.1'').
HISTORY
The dup() and dup2() functions appeared in Version 7 AT&T UNIX.
BSD June 1, 2013 BSD
I have a log file "logreport" that contains several lines as seen below:
04:20:00 /usr/lib/snmp/snmpdx: Agent snmpd appeared dead but responded to ping
06:38:08 /usr/lib/snmp/snmpdx: Agent snmpd appeared dead but responded to ping
07:11:05 /usr/lib/snmp/snmpdx: Agent snmpd appeared dead but... (18 Replies)
Hi All
This is not class assignment . I would like to know awk script how to
list all the duplicate name from a file ,have a look below
Sl No Name Dt of birth Location
1 aaa 1/01/1975 delhi
2 bbb 2/03/1977 mumbai
3 aaa 1/01/1976 mumbai
4 ... (22 Replies)
Can any one give me command How to delete duplicate records with out sort.
Suppose if the records like below:
345,bcd,789
123,abc,456
234,abc,456
712,bcd,789
out tput should be
345,bcd,789
123,abc,456
Key for the records is 2nd and 3rd fields.fields are seperated by colon(,). (19 Replies)
Hi All,
i have a zip file like the format
794051400123|COM|24|0|BD|R|99.98
794051413727|COM|11|0|BD|R|28.99
794051415622|COM|23|0|BD|R|28.99
883929004676|COM|0|0|BD|R|28.99
794051400123|MOM|62|0|BD|R|99.98
794051413727|MOM|4|0|BD|R|28.99
794051415622|MOM|80|0|BD|R|28.99
... (30 Replies)
Hello again, I am wanting to remove all duplicate blocks of XML code in a file. This is an example:
input:
<string-array name="threeItems">
<item>item1</item>
<item>item2</item>
<item>item3</item>
</string-array>
<string-array name="twoItems">
<item>item1</item>
<item>item2</item>... (19 Replies)
Hi
Ive been scratching over this for some time with no solution.
I have a file like this
1 bla bla 1
2 bla bla 2
4 bla bla 3
5 bla bla 1
6 bla bla 1
I want to remove consecutive occurrences of lines like bla bla 1, but the first column may be different.
Any ideasss?? (23 Replies)
Hi all,
I have an input file like this
Now
I have to remove duplicates only in first column and nothing has to be changed in second and third column. so that output would be
Please let me know scripting regarding this (20 Replies)
Gents,
I needs to delete duplicate values and only get uniq values based in columns 2-27
Always we should keep the last record found...
I need to store one clean file and other with the duplicate values removed.
Input :
S3033.0 7305.01 0 420123.8... (18 Replies)
I have a script that builds a database ~30 million lines, ~3.7 GB .cvs file. After multiple optimzations It takes about 62 min to bring in and parse all the files and used to take 10 min to remove duplicates until I was requested to add another column. I am using the highly optimized awk code:
awk... (34 Replies)
I have a BASH script that runs a continuous loop, reading a line from a file, and then spawning a background process to use it. I've placed "date" commands inside it to see where it's slowing down, and everything inside -- including reading the line from the file -- is fast, but the loop bogs... (34 Replies)
Within my text file i have several thousand lines of text with some lines containing duplicate strings/words. I would like to entirely remove those lines which contain the duplicate strings.
Eg;
One and a Two
Unix.com is the Best
This as a Line Line
Example duplicate sentence with the word... (22 Replies)
Gents,
Please give a help
file
--BAD STATUS NOT RESHOOTED--
*** VP 41255/51341 in sw 2973
*** VP 41679/51521 in sw 2973
*** VP 41687/51653 in sw 2973
*** VP 41719/51629 in sw 2976
--BAD COG NOT RESHOOTED--
*** VP 41689/51497 in sw 2974
*** VP 41699/51677 in sw 2974
*** VP... (18 Replies)
Dear forum members,
I want the script to count ALA as one (an example in quotes) and return an integer as 1 and not return 5 as an integer as it does now (look bash script). So how can I upgrade my script that it first checks or after finding all instances of ALA checks whether it is the same... (25 Replies)