RE: nullifying file content..

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I wish to make a correction to my previous post:

ksh:
$ cat .kshrc > somefile
ksh: somefile: file already exists

$ cat .kshrc >! somefile
$ (but what happens is the shell creates a file named ! with the contents of
.kshrc...it does not touch somefile)

$ cat .kshrc >| somefile
$ (the shell overwrites somefile's contents with my .kshrc's contents)

bash:
$ cat .bashrc > somefile
bash: somefile: cannot overwrite existing file

$ cat .bashrc >! somefile
$ (but what happens is the shell creates a file named ! with the contents of
.kshrc...it does not touch somefile)

$ cat .bashrc >| somefile
$ (the shell overwrites somefile's contents with my .bashrc's contents)

zsh:
% cat .zshrc > somefile
zsh: file exists: somefile

% cat .zshrc >! somefile
% (the shell overwrites somefile's contents with my .zshrc's contents)

% cat .zshrc >| somefile
% (the shell overwrites somefile's contents with my .zshrc's contents)

Either the ! or | in front of the caret will override the "noclobber"
setting in the zsh.

-----Original Message-----
From: redhat-list-bounces@xxxxxxxxxx
[mailto:redhat-list-bounces@xxxxxxxxxx]On Behalf Of Schott, Erik J Mr
ANOSC/FCBS
Sent: Thursday, December 16, 2004 2:28 PM
To: General Red Hat Linux discussion list
Subject: RE: nullifying file content..


Not for csh or tcsh.

% cat .cshrc > somefile
somefile: File exists

% cat .cshrc >| somefile
Missing name for redirect

%cat .cshrc >! somefile
%

-----Original Message-----
From: redhat-list-bounces@xxxxxxxxxx
[mailto:redhat-list-bounces@xxxxxxxxxx]On Behalf Of IT Dept
Sent: Thursday, December 16, 2004 2:08 PM
To: 'General Red Hat Linux discussion list'
Subject: RE: nullifying file content..


To bypass the 'noclobber' setting shouldn't it be:

cat /dev/null >| <filename>

Not sure which is right. Don't have that option (noclobber) set so I
don't usually need the command.

Paul Pettit
CCB Inc.

P.s. sorry about that 'rm' recommendation, needed more coffee at the
time.

-----Original Message-----
From: redhat-list-bounces@xxxxxxxxxx
[mailto:redhat-list-bounces@xxxxxxxxxx] On Behalf Of Schott, Erik J Mr
ANOSC/FCBS
Sent: Thursday, December 16, 2004 11:31 AM
To: General Red Hat Linux discussion list
Subject: RE: nullifying file content..


It sounds like you have "noclobber" set.  If you want to temporarily
override it to clear out the file, do this:

cat /dev/null >! <your_file>

-----Original Message-----
From: redhat-list-bounces@xxxxxxxxxx
[mailto:redhat-list-bounces@xxxxxxxxxx]On Behalf Of Rigler, Stephen C.
Sent: Thursday, December 16, 2004 9:44 AM
To: General Red Hat Linux discussion list
Subject: RE: nullifying file content..


cp /dev/null filename

-Steve 

-----Original Message-----
From: redhat-list-bounces@xxxxxxxxxx
[mailto:redhat-list-bounces@xxxxxxxxxx]
On Behalf Of Mulley, Nikhil
Sent: Thursday, December 16, 2004 10:23 AM
To: General Red Hat Linux discussion list
Subject: RE: nullifying file content..

The thing is it is not working under tcsh , while I invoked bash , and
did
the same thing which you have shown , it worked ,
But I did not understand why it did not work under  tcsh  ...
Can any please throw light on this ....

Thanks,
Nikhil

-----Original Message-----
From: redhat-list-bounces@xxxxxxxxxx
[mailto:redhat-list-bounces@xxxxxxxxxx]On Behalf Of Karasik, Vitaly
Sent: Thursday, December 16, 2004 5:10 PM
To: General Red Hat Linux discussion list
Subject: RE: nullifying file content..


well, there is noclobber option which prevent overwriting:
http://unixhelp.ed.ac.uk/environment/env7.html

> -----Original Message-----
> From: redhat-list-bounces@xxxxxxxxxx
> [mailto:redhat-list-bounces@xxxxxxxxxx]On Behalf Of Mulley, Nikhil
> Sent: Thu, December 16, 2004 1:30 PM
> To: General Red Hat Linux discussion list
> Subject: RE: nullifying file content..
> 
> 
> I tried it , but was no use 
> $>mylog.log
> mycron.log: File exists
> $
>  :(
> Thanks,
> Nikhil
> 
> -----Original Message-----
> From: redhat-list-bounces@xxxxxxxxxx
> [mailto:redhat-list-bounces@xxxxxxxxxx]On Behalf Of Karasik, Vitaly
> Sent: Thursday, December 16, 2004 3:50 PM
> To: General Red Hat Linux discussion list
> Subject: RE: nullifying file content..
> 
> 
> > filename
> 
> > -----Original Message-----
> > From: redhat-list-bounces@xxxxxxxxxx
> > [mailto:redhat-list-bounces@xxxxxxxxxx]On Behalf Of Mulley, Nikhil
> > Sent: Thu, December 16, 2004 12:16 PM
> > To: redhat-list@xxxxxxxxxx
> > Subject: nullifying file content..
> > 
> > 
> >     Hi , I have some 400MB file in my home dir , How do I 
> > remove /clear the file content immediately with in a single 
> > command or should I cat it to /dev/null .
> > Can any body please tell me HOWTO...
> >  °v°
> > /(_)\
> >   ^ ^
> >  
> > -- 
> > redhat-list mailing list
> > unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=subscribe
> > https://www.redhat.com/mailman/listinfo/redhat-list
> > 
> **************************************************************
> *********************
> Information contained in this email message is intended only 
> for use of the individual or entity named above. If the 
> reader of this message is not the intended recipient, or the 
> employee or agent responsible to deliver it to the intended 
> recipient, you are hereby notified that any dissemination, 
> distribution or copying of this communication is strictly 
> prohibited. If you have received this communication in error, 
> please immediately notify the postmaster@xxxxxxx and destroy 
> the original message.
> **************************************************************
> *********************
> 
> -- 
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list
> 
> -- 
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list
> 
************************************************************************
****
*******
Information contained in this email message is intended only for use of
the
individual or entity named above. If the reader of this message is not
the
intended recipient, or the employee or agent responsible to deliver it
to
the intended recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited. If
you
have received this communication in error, please immediately notify the
postmaster@xxxxxxx and destroy the original message.
************************************************************************
****
*******

-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list




-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list


-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux