remove(3C) Standard C Library Functions remove(3C)NAME
remove - remove file
SYNOPSIS
#include <stdio.h>
int remove(const char *path);
DESCRIPTION
The remove() function causes the file or empty directory whose name is the string pointed to by path to be no longer accessible by that
name. A subsequent attempt to open that file using that name will fail, unless the file is created anew.
For files, remove() is identical to unlink(). For directories, remove() is identical to rmdir().
See rmdir(2) and unlink(2) for a detailed list of failure conditions.
RETURN VALUES
Upon successful completion, remove() returns 0. Otherwise, it returns -1 and sets errno to indicate an error.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |MT-Safe |
+-----------------------------+-----------------------------+
SEE ALSO rmdir(2), unlink(2), attributes(5), standards(5)SunOS 5.10 14 Aug 2002 remove(3C)
Check Out this Related Man Page
REMOVE(3P) POSIX Programmer's Manual REMOVE(3P)PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the correspond-
ing Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.
NAME
remove - remove a file
SYNOPSIS
#include <stdio.h>
int remove(const char *path);
DESCRIPTION
The remove() function shall cause the file named by the pathname pointed to by path to be no longer accessible by that name. A subsequent
attempt to open that file using that name shall fail, unless it is created anew.
If path does not name a directory, remove(path) shall be equivalent to unlink(path).
If path names a directory, remove(path) shall be equivalent to rmdir(path).
RETURN VALUE
Refer to rmdir() or unlink().
ERRORS
Refer to rmdir() or unlink().
The following sections are informative.
EXAMPLES
Removing Access to a File
The following example shows how to remove access to a file named /home/cnd/old_mods.
#include <stdio.h>
int status;
...
status = remove("/home/cnd/old_mods");
APPLICATION USAGE
None.
RATIONALE
None.
FUTURE DIRECTIONS
None.
SEE ALSO
rmdir(), unlink(), the Base Definitions volume of IEEE Std 1003.1-2001, <stdio.h>
COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol-
ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE
and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained
online at http://www.opengroup.org/unix/online.html .
IEEE /The Open Group 2003 REMOVE(3P)
I have a file like below and want to use awk to solve this problem. The record separator is ">". I want to look at each record section enclosed within ">". Find the row with the 2nd and 3rd columns being 0, such as
10 0 0
I need to take the first number which in this case is 10. Then... (15 Replies)
Over the years I've created a bit of a mess in my directories with duplicate files. I've used fdupes to remove complete duplicates but there are still files which are almost identical which fdupes doesn't look for.
These have the same (or very similar) filenames. So I have tried to create a... (11 Replies)
Hi all,
I have a file which i have to remove some line from it,
the lines that i have to remove from my file is as below:
</new_name></w"s" langue="Fr-fr" version="1.0" encoding="UTF-8" ?> <New_name>
and it is finding at the middle of my file,
is there any command line in linux to do it or do... (10 Replies)
I have a list of file names. However in some instances I might have a "-" at the beginning of the filename or an "=".
For example I might have something like this
set Lst = "file1 file2 file3 -file4 file5="
I want to pick up the ones having "-" at the beginning or "=" and store them in... (22 Replies)
I have a group of files in different directories with characters such as " ? : in the file names. How do I find these files and remove these characters on mass?
Thanks (19 Replies)
How can i remove the first and last character of strings like below:
"^^^613*"
"admt130"
"^^^613*"
"123456"
"adg8484"
"DQitYV09dh1C"
Means i wanna remove the quotes("").
Please help (17 Replies)
In bash, how can one remove the last character of a string? In perl, the chop function would remove the last character. However, I do not know how to do the same job in bash.
Many thanks in advance. (12 Replies)
I would like to remove comments from a bash script. In addition, I would like to remove lines that consist of only white spaces, and to remove blank lines.
#!/bin/bash
perl -pe 's/ *#.*$//g' $1 | grep -v ^]*$ | perl -pe 's/ +/ /g' > $2
#
# $1 INFILE
# $2 OUTFILE
The above code... (10 Replies)
I wish to remove punctuation except a few of my choice, for example, I wish to keep (#) and remove rest of the punctuation marks. Can this script be modified suitably please help.
#!/bin/bash
echo "Enter the type of file: "
read f
a=(*.$f)
for (( i =0; i < ${#a}; i++ ))
do
echo $i " ... (18 Replies)
Hi,
i need to remove mth and nth column from a csv file. here m and n is not a specific number. it is a variable
ex.
m=2
n=5
now i need to remove the 2nd and 5th line.. Please help how to do that.
Thanks!!! (18 Replies)
I want to built a generic code to remove columns from file. Column number will be passed at run time.I may have multiple number like 2,5,10 so Can you please help.
I know how to remove when we know column number but I want a generic code where column number will be passed at run time.
... (14 Replies)
Hi Gurus,
I need to remove comma from first and last line. I tried below code, but no luck. It only remove first line.
Gurus, please help.
awk -F"," '{if(NR==1||NR==$NR) print $1; else print $0}' TEST
sampe file:
ABC HEADER TOTAL RECORDS ARE 2.00,,,,... (13 Replies)
Hi All,
I am trying to remove below file except the last one. With wild char It is removing all. Is there a way to exclude only one file and remove
files:
MM_6000_001
MM_6000_002
MM_6000_003
MM_6000_004
if I do rm * it is removing all. I want the exclude and remove others. any... (14 Replies)
i need to remove a file the problem is it will not let me remove a file because it thought that i was instructing it to remove a directory. the issue was that the file and directory has the same name.
drwxrwxr-x 2 ora102 lpsgrp 256 Apr 03 2009 sql
drwxrwxr-x 2 ora102 ... (12 Replies)