how to zero a file using csh


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers how to zero a file using csh
# 1  
Old 01-06-2004
how to zero a file using csh

Hi

I have always used ksh in the past, but now am using csh. To zero a file using ksh, you simply > filename. What is the command to do the same using csh?

Thanks in advance.
jodie
# 2  
Old 01-06-2004
A common way of zero-ing a file which is portable
across most Unices and shells is

cat /dev/null > file

- Finnbarr
# 3  
Old 01-06-2004
I'm sure there are other ways, but 'cat /dev/null > somefile' works on both.

Cheers,

Keith
# 4  
Old 01-07-2004
echo -n "" > somefile

Regards
JK
 
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 run a file in a csh script?

Hi, I have a csh script. I want to set some variables and execute some command from a file in that script. abc.csh echo "primary script" b setenv XXX ddd set XX make abc I want to execute the commands of "b" file from abc.csh. How can i do that. Please view this link: How to use... (3 Replies)
Discussion started by: vdhingra123
3 Replies

2. Shell Programming and Scripting

Changing the file name to a different one using csh

I have a file name n10-z30-dsr65-ndelt1.00-varp0.08-16x12drw-csq-msf.ps and I want to remove the varp info tag to get n10-z30-dsr65-ndelt1.00-16x12drw-csq-msf.ps Trying to use tr, but when I tried replacing varp with ooo I am getting the results below: echo... (2 Replies)
Discussion started by: kristinu
2 Replies

3. Shell Programming and Scripting

syntax error in .csh file

Hi all, I am trying to modify a script for research purposes and am having difficulty here as I have little prior experience with C-shell scripting. The script looks as follows (it includes tcl commands like runFEP that you can ignore) #!/bin/bash for ((old=1, new=2; old<=4; ... (5 Replies)
Discussion started by: chrisjorg
5 Replies

4. Shell Programming and Scripting

Csh script get file extension

Hi All I have a csh shell script which should check if a given file is a zip file as below: **************************************** #!/bin/csh -f if ]; then echo is a zip file else echo sorry not a zip file endif exit **************************************** ... (1 Reply)
Discussion started by: raj144
1 Replies

5. Shell Programming and Scripting

Is there anyway for file renaming in csh

Hi, I have the files like in a directory. filerefcellhg1.txt filerefcellhg2.txt filerefcellhg3.txt filerefcellhg4.txt filerefcellhg5.txt filerefcellhg6.txt filedonotchange.txt filedonot Desired output: filerefhg1.txt filereflhg2.txt filerefhg3.txt filerefhg4.txt... (1 Reply)
Discussion started by: vasanth_vadalur
1 Replies

6. Shell Programming and Scripting

CSH: step on the lines in a file

Hi, does somebody know how can I step on the lines in a file? I would like to read a file line by line. And after every line I'd like to do other commands. Lets help me! ;) (4 Replies)
Discussion started by: mig8
4 Replies

7. UNIX for Dummies Questions & Answers

How to Convert to CSH File

Hi Everyone, I have a body of code that I'd like to know how to convert to a csh file. In Unix, under a directory, I wish to ls into each of its subdirectories: In Unix prompt I type foreach i(*) foreach? ls $i foreach? end however, when I try to store this body of code in .csh: ... (2 Replies)
Discussion started by: tommms
2 Replies

8. Shell Programming and Scripting

csh failing to call an 2 embedded csh script

I have an extraordinary problem with a csh script.....(feel free to berate the use of this but I'm modifying an existing bunch of them) Anyway, I have a master csh script which in turn calls a second csh script. This second csh script is below. Within this second script are two compiled C++... (1 Reply)
Discussion started by: pollsizer
1 Replies

9. Shell Programming and Scripting

Csh to check for existence of file

Hi, I would like to check the existence of files (doesn;t matter the number of files) in a directory. My file is named in the following manner (always ending with " myfile "). Can anybody give me some guidance? EG: abc1_myfile sdfr_myfile sffgd_myfile and so on ...... My... (9 Replies)
Discussion started by: Raynon
9 Replies

10. Shell Programming and Scripting

Sorting the Void File in CSH

First and foremost, this is not a homework for your information. I'm just new to using c-shell programming and I just wanted to make my life easier @ work. Say, the file contains the following: ID FILE NO. SL VP 1 1 22 33 1 2 ... (3 Replies)
Discussion started by: ilak1008
3 Replies
Login or Register to Ask a Question