03-02-2006
Quote:
Originally Posted by surjyap
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?
or u can type something like this:
# cat /dev/null > filename
where "filename" is the file u want to empty at one shot
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
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
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. Shell Programming and Scripting
Hi all,
I have searched and found various threads about removing spaces from a field within a text file. Unfortunately, I have not found exactly what I'm looking for, nor am I adept enough to modify what I've found into what I need.
I use the following command to remove the first line... (3 Replies)
Discussion started by: carriehoff
3 Replies
4. Shell Programming and Scripting
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
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
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
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
8. Shell Programming and Scripting
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
9. UNIX for Beginners Questions & Answers
Hi,
I'd be grateful for your help with the following. I have a file (file.txt) with 10 columns and about half a million lines, which in simplified form looks like this:
ID Col1 Col2 Col3....
a 4 2 8
b 5 6 1
c 8 4 1
d... (4 Replies)
Discussion started by: aberg
4 Replies