Sponsored Content
Top Forums Shell Programming and Scripting Remove the contents of a file without deleting the file Post 302097735 by jim mcnamara on Tuesday 28th of November 2006 08:07:31 AM
Old 11-28-2006
FWIW -
Code:
> file

is the fastest call, as it truncates the file. And any command, like the sed example above, that has "sed ' ' file > file" in it already sets the file size to zero before running sed. So the sed call (or any call ) is doing nothing because the file is already empty before sed executes.
 

9 More Discussions You Might Find Interesting

1. Solaris

remove the contents of a file

Hi Let say a flat file contains 1000 lines. The cursor is at the 530 line number. Now I like to delete all the line at one ahot. how it can be done? (2 Replies)
Discussion started by: surjyap
2 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. UNIX for Dummies Questions & Answers

Deleting contents of a UNIX File

Hi ALL, Can anyone help me out. I have unix file, I need to delete the contents of the file. Can any one let me know the command to do this. The file has to be there, but the contents should be deleted. thanks Manas (6 Replies)
Discussion started by: manas6
6 Replies

4. Shell Programming and Scripting

Compare two files and remove all the contents of one file from another

Hi, I have two files, in which the second file has exactly the same contents of the first file with some additional records. Now, if I want to remove those matching lines from file2 and print only the extra contents which the first file does not have, I could use the below unsophisticated... (3 Replies)
Discussion started by: royalibrahim
3 Replies

5. Shell Programming and Scripting

Remove lines based on contents of another file

So, this issue is driving me nuts! I was hoping to get a lending hand here... I have 2 files: file1.txt contains: this is example1 this is example2 this is example3 this is example4 this is example5 file2.txt contains: example3 example5 Basically, I need a script or command to... (4 Replies)
Discussion started by: bashshadow1979
4 Replies

6. UNIX for Dummies Questions & Answers

how to copy a file without remove the contents of the target file?

Hello every body, Kindly support me to "copy a file without remove the contents of the target file" Thanks in advance. :) Ahmed Amer Cairo,Egypt (2 Replies)
Discussion started by: ahmedamer12
2 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. Shell Programming and Scripting

Remove or rename based on contents of file

I am trying to use the two files shown below to either remove or rename contents in one of those files. If in file1.txt $5 matches $5 of file2.txt and the value in $1 of file1.txt is not "No Match" then that value is substituted for all values in $5 and $1 of file2.txt. If however in $1 ... (5 Replies)
Discussion started by: cmccabe
5 Replies

9. Shell Programming and Scripting

How to remove contents from file which are under bracket?

hello Friend, In hostgroup file, i have define lots of hostgroups. I need to remove few of them without manually editing file. Need script or syntax. I want to search particular on hostgroup_members and delete hostgoup defination of it. for example. define hostgroup{ hostgroup_name... (8 Replies)
Discussion started by: ghpradeep
8 Replies
ECACCESS-ASSOCIATION-DELETE(1p) 			User Contributed Perl Documentation			   ECACCESS-ASSOCIATION-DELETE(1p)

NAME
ecaccess-association-delete - Delete Association SYNOPSIS
ecaccess-association-delete -version|-help|-manual ecaccess-association-delete [-debug] [-gateway name] association-name DESCRIPTION
Allow deleting an ECtrans Association. Once deleted the Association can not be retrieved. The History associated with this Association will also be removed from the ECaccess Gateway Database. ARGUMENTS
association-name The name of the Association to delete. OPTIONS
-gateway name This is the name of the ECaccess Gateway where the Association is installed. It is by default the Gateway you are connected to. In order to get the name of your current Gateway you can use the ecaccess-gateway-name command. When using the commands at ECMWF the default Gateway is always "ecaccess.ecmwf.int". -version Display version number and exits. -help Print a brief help message and exits. -manual Prints the manual page and exits. -debug Display the SOAP messages exchanged. EXAMPLES
ecaccess-association-delete -gateway ecaccess.ecmwf.int test Remove the test Association on the ecaccess.ecmwf.int Gateway. ecaccess-association-delete test2 Remove the test2 Association on the default Gateway. SEE ALSO
ecaccess-association-get, ecaccess-association-list, ecaccess-association-protocol, ecaccess-association-put and ecaccess. perl v5.14.2 2012-04-16 ECACCESS-ASSOCIATION-DELETE(1p)
All times are GMT -4. The time now is 10:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy