how to delete content in a file (delete content only)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to delete content in a file (delete content only)
# 1  
Old 05-15-2008
CPU & Memory how to delete content in a file (delete content only)

Hi Friends

I have a file called processLog.txt file

processLog.txt
---------------
echo "line starts "$LINE
suppCode=${LINE:0:3}
#gatewayArchive=`scp root@mrp-gateway:/usr/local/apache/d...2708173000.txt /home/krishnaveni/scripts/tempFolder`
#echo "gateway files :"$gatewayArchive
#file1=$suppCode$DtTime"*.txt"
file1="112042708173000.txt"
echo "file1 :"$file1
#
# checking files in sftp server
#
find_sftp_files $file1
--------------------------

once my task has done
just i need to delete content of that log file

i need to delete only content not file
is it possible
please help me from this problem

Thanks
Krish.
# 2  
Old 05-15-2008
cat /dev/null > processLog.txt
# 3  
Old 05-15-2008
Thank you so much
it helpmed a lottttttt........Smilie
# 4  
Old 05-15-2008
Shorter
Code:
echo > file.name

# 5  
Old 05-15-2008
Or
Code:
>file.name

# 6  
Old 05-15-2008
Quote:
Originally Posted by alamitab
cat /dev/null > processLog.txt
Quote:
Originally Posted by Klashxx
> file.name
Both of those produce empty files.


Quote:
Originally Posted by danmero
echo > file.name
This produces a file with one character.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

AIX Delete all mbox content

Hi, How to Delete all mbox content in AIX? Thanks. (2 Replies)
Discussion started by: big123456
2 Replies

2. Shell Programming and Scripting

awk to delete content before and after a matched pattern

Hello, I have been trying to write a script where I could get awk to delete data before and after a matched pattern. For eg Raw data Start NAME = John Age = 35 Occupation = Programmer City = New York Certification Completed = No Salary = 80000 End Start NAME = Mary Age = 25... (2 Replies)
Discussion started by: sidnow
2 Replies

3. Shell Programming and Scripting

Delete file content by asking user Yes/No...

I have following script to ping multiple ips but i want to delete ip.csv file content after running script .....but before deleting content i have ask user yes/No prompt depend on user input Yes/no ip.csv content will delete.. #!/bin/bash for enodeb in `cat /tmp/ip.csv` do ping -c 2... (3 Replies)
Discussion started by: Ganesh Mankar
3 Replies

4. Shell Programming and Scripting

Help - delete content inside square brackets under conditions

I have the file sed1.txt and I need to strip the brackets (]) and content inside them only when I have two or three letters followed by a colon. for example,it may be any letter, not just abc ] ] #-- cat sed1.txt 1 ] FISICA 2 ]PORTUGUES 3 ] ]MATEMATICA 4 ]]INGLES ] 5 ]QUIMICA 6... (2 Replies)
Discussion started by: dperboni
2 Replies

5. Shell Programming and Scripting

how to delete special characters from the file content

Hello Team, Any one suggest how to delte the below special character from a file which is having one column 10 rows of same below content. ---------------------------------------- Kosten|bersicht gemd_ ' =Welche Kosten kvnnen... (2 Replies)
Discussion started by: kanakaraju
2 Replies

6. Shell Programming and Scripting

Delete content of file 1 in file 2 with shell script

OK, best is I explain what the operating enviroment is. Linux, but Motomagx. It is a Linux operated mobile phone, Motorola V8. I am writting a shell script, but got stuck. I have to delete the complete content of file 1 in file 2. I have attached the 2 files. You can see that the content of... (2 Replies)
Discussion started by: rasputin007
2 Replies

7. Shell Programming and Scripting

shell script to search a string and delete the content

Hi, I've a shell script e.g. #!/bin/bash echo "Enter the next hop id" read nhid echo "enter the IP address" read IP echo "enter the interface name" read name echo "enter the enable/disable state" read state exit 0 now from this script i want to search strings in another (.cam) ... (6 Replies)
Discussion started by: vic_mnnit
6 Replies

8. Shell Programming and Scripting

I need to delete the content out of a number of logs

I'm just starting out in scripting (taking online classes) but I need to know how to clean out (delete) the content of a number of logs. All of the files end in 'trc'. Does anyone have a script or command (SED or AWK) I can use? Julie (4 Replies)
Discussion started by: Jbolin01
4 Replies

9. UNIX for Dummies Questions & Answers

To delete content of many file

Hi All, I want to delete the content of some files,which are specified through wild-card option,but i want to restore the file. I.e I just want to delete the contents file parameters shouldn't be changed. . Please provide me the answer. Thaning u all in advance Athresh (4 Replies)
Discussion started by: athresh
4 Replies
Login or Register to Ask a Question