Regarding overwriting the textfile with output what we get!


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Regarding overwriting the textfile with output what we get!
# 1  
Old 11-03-2009
Regarding overwriting the textfile with output what we get!

Hi freinds,

My problem is I have a script which is used for our office work...

in that with my userid i can append the LOGFILE with the output which i get while running the script..

for this i use the below command

Code:
output >> $LOGFILE

but with the same script my colleague is not able to append the LOGFILE.

it is not giving any error but the full output is not going to LOGFILE. only half the part of output is going to LOGFILE.

what can i do to overcome this?

Last edited by smarty86; 11-03-2009 at 07:37 AM..
# 2  
Old 11-03-2009
output >> $LOGFILE

the above command is to append to the LOGFILE and not to overwrite (> overwtites the file and >> appends to the file)
# 3  
Old 11-03-2009
yes..sorry that was a error.. I want to append to LOGFILE... now edited.. it is working fine for me n my freind.. but foe one of my colleague full output is not going to LOGFILE..what may be the problem?
# 4  
Old 11-03-2009
Most probably that file is owner by your user, and has permission 644 (or more restrictive) (mode 664 = -rw-r--r-- in ls -l). If he's in the same group as you, add the group writeable bit (chmod g+w). Otherwise you'll have to add the other writeable (chmod o+w), but this is dangerous as it will allow anyone to write to it.
# 5  
Old 11-03-2009
where i should do that pludi? i mean chmod g+w???
# 6  
Old 11-03-2009
If you don't know a command, there is one that can (probably) always help you:
Code:
man <command>

In your case, you have 2 options:
Code:
chmod g+w /path/to/logfile

or
Code:
cd /path/to/
chmod g+w logfile

# 7  
Old 11-03-2009
Thanks Pludi..will try and let you know.. Thanks a lot for your kind reply..

hey brother one more request for you.

I have one more thread to which nobody is giving me the soluton..could you please try and help me?

https://www.unix.com/shell-programmin...-format-2.html
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to separate sorte different characters from one textfile and copy them in a new textfile?

My first post, so don't kill me :) Say i open some textfile with some example like this. on the table are handy, bread and wine Now i know exactly what is in and i want to separate and sorted it in terminal to an existing file with another 2 existing lines in like this: table plane ... (3 Replies)
Discussion started by: schwatter
3 Replies

2. Shell Programming and Scripting

sed is not overwriting a file

hi i have a file as in follwoing: cat apple.txt Apple is a fruit But this fruit is costly Now I used the sed command and i see output as in following # sed 's/fruit/healthy &/' fruit.txt Apple is a healthy fruit But this healthy fruit is costly # sed works fine here. But... (2 Replies)
Discussion started by: Priya Amaresh
2 Replies

3. Shell Programming and Scripting

File overwriting

Hi, An application is transferring a file to linux system with same file name. As file is transferring with same name always file will be overwritten. In this case we want to know what times file was overwirtten like below. Modify: 2014-05-12 00:52:01.000000000 Modify: 2014-05-12... (2 Replies)
Discussion started by: Satyak
2 Replies

4. Shell Programming and Scripting

Overwriting file with sftp

I have a script, which runs through cronjob every night 9 PM. It is supposed to do following tasks -- 1- Connect to ftp.testsite.com via user redtest 2- Fetch file red_bill.txt to my local server, where my script is residing. 3- Rename red_bill.txt to red_bill.V01.txt everyday on sftp server.... (4 Replies)
Discussion started by: solaris_1977
4 Replies

5. Ubuntu

Top output to textfile not working in cronjob

Hello, If i run the following script from the cmdline it works just fine however if i run it via root cronjob it doesn't write to the file at all. It is chmod 777 now so shouldnt be any right issues. Shellscript looks like this: /usr/bin/top -b -n 1 -u nagios >> /var/log/test.log Cronjob... (7 Replies)
Discussion started by: heady89
7 Replies

6. Shell Programming and Scripting

Script to get required output from textfile

Hi Iam running below script on one text file. usr/xpg4/bin/awk 'BEGIN {print "IP HOST_NAME SUB "} /IP IS/ {IP=$3} /local/ {HOST=$1} /PPPoE/ {SUB=$3 ;print IP, HOST, SUB} ' /Scripts/sub_report_$FILE>/Scripts/sub_final_report_.txt the output is coming as below IPHOST_NAME SUB ... (16 Replies)
Discussion started by: surender reddy
16 Replies

7. UNIX Desktop Questions & Answers

overwriting on a file

I have loads of files in different directories which I do miner changed on them and till now I have to create totally new directories for them, specially as I deal with a whole directory at once :wall::wall::wall::wall: it creates such as mess really e.g. FILES="F1/*" for X in $FILES do... (2 Replies)
Discussion started by: A-V
2 Replies

8. Linux

Is it possible to revert a file after overwriting it ?

Long story short, there was some sort of corruption with my ide and the script I was working on has been over written with nothing (the file is blank now). The IDE doesn't store a back up from what I know (I'm using notepadd++ in wine lol I know I know I'm addictted to the nppftp sidebar and geany... (1 Reply)
Discussion started by: noPermissions
1 Replies

9. Cybersecurity

Overwriting sudo

Hi all, I have configured a user and provided him the priviledge to vi a file owned by root account. The settings are as below $ id uid=1661(conuser) gid=6615(staff) $ sudo -l (root) NOPASSWD: /usr/bin/vi /opt/DBconserver/etc/conserver.cf I just realised that when the user execute... (5 Replies)
Discussion started by: mohzub
5 Replies

10. Shell Programming and Scripting

Overwriting File

How to overwrite every time a particular portion of a file? ---------- Post updated at 02:16 PM ---------- Previous update was at 02:07 PM ---------- I have a file whose contents are something like: Output of "apachectl fullstatus" command: ---------------------------------------------... (3 Replies)
Discussion started by: proactiveaditya
3 Replies
Login or Register to Ask a Question