Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Trying to empty file using > but the file size increasing when next append Post 302208065 by firdousamir on Monday 23rd of June 2008 01:08:35 AM
Old 06-23-2008
Trying to empty file using > but the file size increasing when next append

AIX 5.3 / KSH

I have a Java application which creates a log file a.log. I have a KSH script which does the following action

Code:
cp a.log /directory2/b.log
> a.log

After this the file size goes to 0 as per "ls -l"

Then next time when the application writes into this file, the file size is goes to the previous before the ">" operation happened.

I tried the Code in a different style:
Code:
cp a.log /directory2/b.log
cp /dev/null a.log

No change. What is the best way to do this?

***NOTE: I cannot use rm -f/touch method for cleaning up the log file because it requires a restart of the application.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

increasing ufs file system size in solaris

How do i increase the filesystem size on a root partition? There is a slice with root on it, its like 2 gigs and nothing else is broken out except home. I want to increase root filesystem (and slice) and break out /usr and /var. This is solaris 9, only has solaris volume manager on it. ... (6 Replies)
Discussion started by: BG_JrAdmin
6 Replies

2. AIX

Increasing File Size on AIX

Hi I am a bit green to AIX - but when our backup operator tries to do a restore from one AIX box to another, he get's the error: 'A file cannot be larger than the value set by ulimit' I am wondering what is the impact of increasing the AIX filesize limit of 2 gb to unlimited. And how would... (1 Reply)
Discussion started by: Rosie C
1 Replies

3. HP-UX

Help on increasing fs size

Hi Experts, I am not sure whether my question should be in this thread or some other one. I am using HP Tru64 system. Currently one of my filesystem /others is almost full. I need to know the exact commands to increase this filesystem. Please show me how to check for free partitions and add... (5 Replies)
Discussion started by: kingsto88
5 Replies

4. Solaris

increasing file system size

Hi Can anyone explain me how to increase the filesystem size. We can do it when the system is running? It needs an reboot? (8 Replies)
Discussion started by: rogerben
8 Replies

5. Shell Programming and Scripting

Unix file empty.. but size is greater than zero??/

Hi, I have a file by redirecting some contents in unix shell. Even when there is no content that is being redirected, the file size still shows greater than zero. but even if there is no matching pattern the file APPRES has size greater than 0bytes. awk -f AA.awk $logfile>APPRES... (3 Replies)
Discussion started by: justchill
3 Replies

6. Linux

Increasing total data size per file system request for block drivers

Hi All, I am writing a block driver for a 2GB SD card where i get the total amount of data per request as follows: struct request *req; uint card_addr,total_bytes; struct request_queue *rq = BlkDev->queue; req = elv_next_request(rq); .. .. card_addr = req->sector*512;... (1 Reply)
Discussion started by: amio
1 Replies

7. Shell Programming and Scripting

if file is NOT empty, then append content to file

hi people, i have texts down.txt and down-new.txt and i want to check; - if down-new.txt is NOT empty, then write date and its content to /home/gc_sw/down.txt for example; down.txt:AAAA SSSS down-new.txt:123 456 and after checking down-new.txt is NOT empty, down.txt should... (10 Replies)
Discussion started by: gc_sw
10 Replies

8. Shell Programming and Scripting

Symbolic link to an empty file shows size 2

Hi, I have created an empty file and a symbolic link to a file. But when I issue the following commands, I am getting the output 2. stat -c "%s" linkfile du -hb linkfile Why this is happening? (4 Replies)
Discussion started by: royalibrahim
4 Replies

9. Solaris

Help with increasing file system size in Sun OS 5.9

Hi, I have recently taken up to support these SunOS 5.9 sun4u sparc SUNW,Sun-Fire-V240 boxes and got a request to increase the size of /backup01 as its getting filled up quickly and can't play much on it as these are production servers. As I have no idea about how to do this, can anyone let me... (0 Replies)
Discussion started by: phanidhar6039
0 Replies

10. Emergency UNIX and Linux Support

Script to fill the file system mount with empty files to desired size

We are regularly using for our testing, where we are manually filling up the mount with desired size with following command dd if=/dev/zero of=file_2GB bs=2048000 count=2000 We are planning to automate the task where taking input for % of size as one input and the name of the file system... (8 Replies)
Discussion started by: chandu123
8 Replies
FBB::mlm(3bobcat)                                             OFoldStream manipulator                                            FBB::mlm(3bobcat)

NAME
FBB::mlm - Manipulator modifying left margins of OFoldStream objects SYNOPSIS
#include <bobcat/ofoldstream> or #include <bobcat/ofoldstreambuf> Linking option: -lbobcat DESCRIPTION
The mlm class implements a manipulator that can be inserted into OFoldStream objects to modify the stream's left margin by a requested amount. The request cannot result in a negative left margin value. If a negative left margin would be the arithmetic result of the request then left margin 0 will silently be used. Depending on the tab-setting of the OFoldStream the inserted value represents the number of blank space characters or the number of tab-characters that will be added to the left margin. The request will be processed at the next newline character or std::flush or std::endl manipulator that is inserted into the stream. If a line is still empty once an mlm object and a flush manipulator are inserted into the stream then the new left margin will be effective at the next word inserted into that line (cf., the example section below) A bad_cast exception is thrown when the manipulator is inserted into an ostream that is not using a OFoldStreambuf buffer. NAMESPACE
FBB All constructors, members, operators and manipulators, mentioned in this man-page, are defined in the namespace FBB. INHERITS FROM
- CONSTRUCTOR
o mlm(int addValue): The standard copy constructor is available. MEMBER FUNCTIONS
There are no public or protected member functions in this class. EXAMPLE
#include <iostream> #include <bobcat/ofoldstream> using namespace std; using namespace FBB; int main() { OFoldStream out(cout, 0, 80); out << "hello world (left margin is 0)" << mlm(4) << " " "this uses a 4 character wide left margin " << mlm(-10) << flush << "left margin -6 changed to 0, active on this line "; return 0; } FILES
bobcat/mlm - defines the class interface SEE ALSO
bobcat(7), manipulators(3bobcat), lm(3bobcat), ofoldstream(3bobcat) BUGS
None Reported. DISTRIBUTION FILES
o bobcat_3.01.00-x.dsc: detached signature; o bobcat_3.01.00-x.tar.gz: source archive; o bobcat_3.01.00-x_i386.changes: change log; o libbobcat1_3.01.00-x_*.deb: debian package holding the libraries; o libbobcat1-dev_3.01.00-x_*.deb: debian package holding the libraries, headers and manual pages; o http://sourceforge.net/projects/bobcat: public archive location; BOBCAT
Bobcat is an acronym of `Brokken's Own Base Classes And Templates'. COPYRIGHT
This is free software, distributed under the terms of the GNU General Public License (GPL). AUTHOR
Frank B. Brokken (f.b.brokken@rug.nl). libbobcat1-dev_3.01.00-x.tar.gz 2005-2012 FBB::mlm(3bobcat)
All times are GMT -4. The time now is 11:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy