Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Deleting contents of a UNIX File Post 302209605 by jim mcnamara on Friday 27th of June 2008 01:09:14 PM
Old 06-27-2008
try one of:
Code:
cat /dev/null > file
echo "" > file

If none of these work, you may not have privilege to do this on the file.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove the contents of a file without deleting the file

Hi All, I want to delete the contents of few files which are really huge in size. How the same can be done by using sed. Is there any other alternative to sed. Thanks in advance (10 Replies)
Discussion started by: sumesh.abraham
10 Replies

2. Shell Programming and Scripting

Query:just need to remove the contents of the file without deleting that

Hii, Please suggest me how can i only remove the contents of the file without deleting it. (3 Replies)
Discussion started by: namishtiwari
3 Replies

3. HP-UX

how to redirect the growing contents of log file to another file in unix

how to redirect the growing contents of log file to another file in unix (2 Replies)
Discussion started by: megh
2 Replies

4. Shell Programming and Scripting

Deleting the contents of a folder older than X hours

Every day a new .zip file is uploaded to a folder and at mid-night the zip file is to be extracted into a /data/ folder, inside a date-named folder. # This should extract the contents of a zip file into the /data/ folder into a date based folder /usr/bin/unzip -a -o... (15 Replies)
Discussion started by: worchyld
15 Replies

5. UNIX for Dummies Questions & Answers

Script For Deleting Contents of "Live" Log File

In our shop, we have a situation where a log file from our interface engine software has begun maxing out in file size (reaching the 32-bit "2147483647" limit). Currently, the only way to rectify this is to stop the interface and restart it, which generates a new log. Easy enough, but the... (6 Replies)
Discussion started by: rjhjr64
6 Replies

6. UNIX for Dummies Questions & Answers

How to add/sum same contents in a unix file

Input 1 2N 2N 1 2N 2N 1 2N 2N 1 2N Ateus 1 3 Mobiles 3M-100 1 3 Mobiles 3M-100 1 3 Mobiles 3M-100 1 3GNET 3gnet 1 3GNET 3gnet 1 3GNET G2828 1 3GNET G2828 1 3GNET G2829 1 3GNET G2829 1 3GNET G2829 OutPut should be 3 2N 2N 3 3 Mobiles 3M-100 2 3GNET 3gnet (4 Replies)
Discussion started by: gagan2010
4 Replies

7. Shell Programming and Scripting

How to clear contents of a file without deleting it.

Hi, I have a script which will use an input.txt file as an input file. I am providing data to this input file in the script and once the script is executed, I want to clear all the contents of this file as during the second time use of this script, I'll be appending the data in this input... (5 Replies)
Discussion started by: pat_pramod
5 Replies

8. UNIX for Dummies Questions & Answers

Write terminal contents into a one file in UNIX

Hi guys, How to write terminal contents into a file in Unix operating system Actually I created GUI by using Gtk2-perl. I want to display data on GUI whatever the contents writing on terminal. So which command I have to use and where that command to be run I mean in shell script or Perl... (2 Replies)
Discussion started by: kiran425
2 Replies

9. UNIX for Dummies Questions & Answers

What option will use for deleting directory with all its contents?

Hi How to completely delete directory with all it contents I try to use rmdir -r but it give error Thanks ---------- Post updated at 03:10 AM ---------- Previous update was at 02:52 AM ---------- Hi all I got the solution for my thread i use mkdir with the option -p Thanks (1 Reply)
Discussion started by: Tauatioti
1 Replies

10. UNIX for Beginners Questions & Answers

UNIX utility to find difference in folder, file and contents of file against a base version

Hi, I am trying to find out whether there are any Unix utilities that compares folders, files and contents within the file and provides a comprehensive report. The comparison can be against base version of a folder and file with content. Can you please let me know of such a utility? Thanks,... (6 Replies)
Discussion started by: Sripathi_ks
6 Replies
privileges(3)						     Library Functions Manual						     privileges(3)

NAME
privileges: priv_addset(), priv_delset(), priv_ismember(), priv_isobserved(), privset_add(), privset_alloc(), privset_copy(), privset_del(), privset_empty(), privset_fill(), privset_free(), privset_intersect(), privset_inverse(), privset_isempty(), privset_ise- qual(), privset_isfull(), privset_ismember(), privset_issubset(), privset_subtract(), privset_union() - privilege manipulation operations for checking and debugging purposes SYNOPSIS
Parameters dstp to type; points to the destination privilege set. num type; specifies a privilege by number. privid type; contains the ID of the privilege to be acted upon. privname type; string that contains the name of the privilege to be acted upon. privp Pointer to type; points to the privilege set to be acted upon. srcp to type; points to the source privilege set. DESCRIPTION
Adds the privilege privname to the privilege set referred to by privp. Removes the privilege privname from the privilege set referred to by privp. Check whether the named privilege privname is a member of the privilege set privp. Checks whether the calling process observes the named privilege privname See privileges.5 for more information on when a process observes a privilege. Adds the privilege privid to the privilege set referred to by dstp. Allocates memory for a privilege set of type but does not initialize the space. The space allocated by this routine should be released using the routine. Copies the privilege set referred to by srcp to the privilege set referred to by dstp. Removes the privilege specified by num from the privilege set referred to by privp. Clears all privileges from privp. Assigns all privileges, including those not currently define on the system, to the privilege set privp. Deallocates the space used by the privilege set referred to by privp. If privp is NULL, no action occurs. Finds the privileges that the privilege sets srcp and dstp have in common and places the results in the privilege set dstp. Inverts the privilege set pointed to by privp. Checks whether the privilege set privp is the empty set. Checks whether the privilege sets srcp and dstp are equal sets. Check whether the privilege set privp is the full set of privileges. A full set of privileges is a set with all bits set, regardless of whether the privi- lege is currently defined on the system. Check whether the privilege privid is a member of the privilege set privp. Checks whether the privilege set srcp is a subset of the privilege set dstp. Subtracts the privilege set referred to by srcp from the privilege set referred to by dstp. Checks the privileges in the privilege sets srcp and dstp and puts any privilege that is in either set into dstp. RETURN VALUE
and return the following values: Successful completion. Function failed. is set to indicate the error. and return the following values: Non-zero number. Condition is TRUE. Condition is FALSE. is set to indicate the error. returns the following values: pointer Successful completions. Returns a non-null pointer to the allocated space. NULL pointer Function failed. Returns a null pointer and sets to indicate the error . ERRORS
If any of the following conditions occur, the functions fail and set Insufficient memory available to allocate space to hold a privilege set. The application can try again later. Invalid argument. SEE ALSO
priv_getbyname(3), priv_getbynum(3), priv_set_to_str(3), priv_str_to_set(3), privileges(5). privileges(3)
All times are GMT -4. The time now is 06:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy