file handling in perl without using system command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting file handling in perl without using system command
# 1  
Old 10-09-2009
file handling in perl without using system command

Hi ,

Is there any way to achieve following using perl program (i.e without using system command).

1.system ("echo 'test' > /usr/spool/ship.csv");
2.system ("cat /usr/ajay_test* >> /usr/spool/RAM/work/patil.csv");
3.system("> /usr/spool/ajay.txt");

e.g

for system("rm -f /usr/ajay.txt");
we can use
unlink "/usr/ajay.txt");

Thanks,
Ajay




# 2  
Old 10-09-2009
Code:
open FH, ">test.txt";

print FH "testing data";

Note: perl file handling, google shows this first, Perl File Handling: open, read, write and close files -- google and learn it will be much more interesting.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl : How is file handling working here??

Hi, I have a perl script which is just reading from the file but what I would like to understand is how the counter is moving without using the loop in the script. Below are the details: $ more /tmp/abc.txt This is 0 This is 1 This is 2 This is 3 This is 4 This is 5 This is 6 This... (2 Replies)
Discussion started by: siddharthjindal
2 Replies

2. Shell Programming and Scripting

Perl file handling error

Hi, I am reading and file and writting each word to other file. where I have used array to store the data. I am getting below error as "Use of uninitialized value in concatenation (.) or string at customize_split_raw.pl line 51, <IN_FILE> " Where my line 51 code is 50 foreach... (8 Replies)
Discussion started by: Beginer123
8 Replies

3. Programming

Perl help for file handling

$# some text $$ some text $@ some text $$. some text Mg1 some text Mg2 some text . . . Mg10 some text The above 10 lines are to be extracted except the lines starting from $#,$$.,... (4 Replies)
Discussion started by: baig.abdul
4 Replies

4. Shell Programming and Scripting

handling multiple files using awk command and wants to get separate out file for each

hai all I am new to the world of shell scripting I wanted to extract two columns from multiple files say around 25 files and i wanted to get the separate outfile for each input file tired using the following command to extract two columns from 25 files awk... (2 Replies)
Discussion started by: hema dhevi
2 Replies

5. Shell Programming and Scripting

Perl revers File handling

Hi Experts, I have a big text file, so I want read it at eof to upper bound !. after I use a fseek to go SEEK_END, is it possible to step up upperbound? Best Regards. Note that I'm used perl script. (2 Replies)
Discussion started by: Zaxon
2 Replies

6. Shell Programming and Scripting

File handling, getopts command in unix

I need to create a shell script having the menu with few options such as 1. Listing 2. Change permissions 3. Modify Contents 4. Delete Files 5. Exit 1. For 1. Listing: Display a special listing of files showing their date of modification and access time (side by side) along with their... (2 Replies)
Discussion started by: bab123
2 Replies

7. Shell Programming and Scripting

Need Help w/PERL system command

Hi, I'm wanting to run an nslookup, dig or whatever to check for the existence of a printer. The PERL script will display the results on the screen, but I can't figure out how to capture the result & test the value. Any ideas will be greatly appreciated!!! Thank You (1 Reply)
Discussion started by: lorik
1 Replies

8. Shell Programming and Scripting

perl - system command

Can this be done without using te system command? I have a directory with a large number of files in it, but I am interested in only the 8 most recent. The directory looks like -rw-rw-rw- 1 adsm adsm 13412 Sep 22 08:31 events_dump_09222005.csv.gz -rw-rw-rw- 1 adsm adsm ... (5 Replies)
Discussion started by: reggiej
5 Replies

9. UNIX for Dummies Questions & Answers

file handling problem in perl......

Hi, I am opening a file......then i am wrting some data into it......and i am reopening the file again but ......i get a error cannot open file....... $::file= "\adder\testfile.txt" open(TEST1,$::file); some write operation close(TEST1) open(TEST1,$::file) 'I GET A ERROR CAN OPEN... (2 Replies)
Discussion started by: vivekshankar
2 Replies

10. Shell Programming and Scripting

Perl run system command

Can perl execute a system command similar to the C function System()? Thanks. Gregg (1 Reply)
Discussion started by: gdboling
1 Replies
Login or Register to Ask a Question