how to truncate a large (8 GB) file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to truncate a large (8 GB) file
# 1  
Old 07-05-2006
Error how to truncate a large (8 GB) file

Hello,

I need to truncate a large file without deleting and touching it again.

i tried the below commands but no use because of the huge file size

cat <<! > errors
and
echo > errors

Could someone please help.

Thanks,
Sateesh
# 2  
Old 07-05-2006
cp /dev/null largefile
cat /dev/null > largefile
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

recover the truncate file

hi All, how to recover the truncate file in unix. Thanks!:wall: (2 Replies)
Discussion started by: krbala1985
2 Replies

2. Shell Programming and Scripting

how to recover the truncate file in unix

how to recover the file in unix. Thanks in advance.:wall: (1 Reply)
Discussion started by: krbala1985
1 Replies

3. Shell Programming and Scripting

Truncate file name to 40 characters

Hello all. I would like to make a script (or two shell scripts) that will do the following. I need the maximum file name and directory name to be 38 characters long. As well, if shortening the file name ends up making all of the files in that directory have the same name, then I would like... (9 Replies)
Discussion started by: marcozd
9 Replies

4. UNIX for Dummies Questions & Answers

How to truncate thousands of file names

Folder of e-mails in maildir format had been corrupted. Typical file name is 1246281161.6777.m21JH:2,S . The " :2,S prevents " copying to another device. How can I simply remove the last four characters? (2 Replies)
Discussion started by: steve900
2 Replies

5. Shell Programming and Scripting

Truncate extra contents from file

Hi all, i have a file and i want that after 6th slash "/" in each line of the file the contents gets truncated. Can anyone tell me how to do that !! thanks in advance One more thing how can i change the size of output buffer of console, as i had very long output and its not... (2 Replies)
Discussion started by: glamo_2312
2 Replies

6. Shell Programming and Scripting

Truncate multiple file extensions

Hi, I have files with names like file1.txt.txt.txt.txt and file2.txt.txt.txt.txt.txt............ (random infinite number of .txt exist). how to truncate (mv) their names to ones with single .txt extension like file1.txt and file1.txt ? In other words, how to extract the filename upto first... (12 Replies)
Discussion started by: prvnrk
12 Replies

7. UNIX for Dummies Questions & Answers

Truncate last <n> characters from a file

I am trying to concatenate 2 files, but before concatenation, I would like to strip off the final character from the first file. The final character is a form feed (ascii 012 / hex 0C) and there will be an unknown number of these characters in the file. It is only the very last one which I want... (1 Reply)
Discussion started by: Gwailo88
1 Replies

8. Shell Programming and Scripting

truncate file script is not working

Hi All, I have an application which writes log in to a file. The file size becomes around min of 800 MB a day. So I have written a script which backup the file and truncate the original file. My script is like this cp X.log /backup/X.log1 > X.log But the second truncate command... (3 Replies)
Discussion started by: mvenkat_in
3 Replies

9. Shell Programming and Scripting

Truncate File contain

I have one file which first line is blank and second line has some data. $cat filename output: 30-MAY-07 I want to store 30-MAY-07 value in one variable. for that I wrote var="`head -2 filename`" It will give that result but I want to truncate the first line which is blank. plz help. (2 Replies)
Discussion started by: rinku
2 Replies
Login or Register to Ask a Question