Output after a perl script gives a file with size zero.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Output after a perl script gives a file with size zero.
# 1  
Old 02-03-2012
Output after a perl script gives a file with size zero.

Hi,
I have a unix shell script which generates a flat file after connecting to Teradata servers to fetch tables and views and also picks up modified unix scripts from the specified paths.
Later on the script calls a perl script to assign a value based on the type of object in the flat file which is being used in another table this data is loaded.

My issue is that the file has all the filenames, tablenames etc before the perl script is called.. once the perl script is called the flat file becomes zero..

Kindly help me figure out what could possibly be a reason for this as it behaves this way on specific servers.

Thanks.
# 2  
Old 02-03-2012
The script has to open the file for write, then close it without writing.

If you post the code (parts dealing with file i/o) someone can help you.
# 3  
Old 02-03-2012
This is the part of the shell script which calls the perl script,
Code:
perl ../get_unix_objs.pl $inFile $servername $outFile 2>$outFile.err

An extract from the perl script(get_unix_objs.pl) is given below on how it checks for the type of file and assigns a number for table load purpose,
Code:
if ( $file_name =~ /\.k{0,1}sh$/io )
 {
  $obj_type_id = 22;
 }
 elsif ( $file_name =~ /\.mload\.ctl$/io )
 {
  $obj_type_id = 25;
 }
 elsif ( $file_name =~ /\.bteq\.ctl$/io )
 {
  $obj_type_id = 26;
 }
 elsif ( $file_name =~ /\.tpump\.ctl$/io )
 {
  $obj_type_id = 27;

The infile has all the script names but the outfile has file size zero Smilie

Last edited by Franklin52; 02-03-2012 at 02:06 PM.. Reason: Please use code tags for data and code samples, thank you
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Unable to get the size of remote file using Net::FTP Perl Script

Hi, I am using below piece of code to get the size of the remote file. $ftp->cwd($destination) or $error=$ftp->message; if(!$error) { $ftp->put($file) or $error=$ftp->message; print "FTP size = \n"; ... (3 Replies)
Discussion started by: FarooqOnline
3 Replies

2. Solaris

Script fails when generated output file reaches a particular size

Hi All, New to unix. Here is the problem. Running a script that extracts data from hyperion essbase and generates a file in unix. This script fails most of the times with a very low success rate. The data has increased a lot in the last few months resulting in the file being more than 2 gb. ... (2 Replies)
Discussion started by: noufalshaw
2 Replies

3. Shell Programming and Scripting

Script to read file size and send email only if size > 0.

Hi Experts, I have a script like $ORACLE_HOME/bin/sqlplus username/password # << ENDSQL set pagesize 0 trim on feedback off verify off echo off newp none timing off set serveroutput on set heading off spool Schemaerrtmp.txt select ' TIMESTAMP COMPUTER NAME ... (5 Replies)
Discussion started by: welldone
5 Replies

4. Shell Programming and Scripting

Perl Script to check file date and size

Hi guys, i am new to perl. I started reading the perl documents and try to come up with some logic. I am trying to create a script that would go into a location, search for todays files, then searches for all .txt files from today. If todays not found, its an error If file size is less... (26 Replies)
Discussion started by: DallasT
26 Replies

5. Shell Programming and Scripting

FTP Perl Script File Size Mismatch.

Hello, I've written a Perl script that copies a set of files from one server to another. Prior to transferring a file the script gets the file size from the source system and compares this to the file size received in the target system. Except that the file sizes are slightly different. ... (1 Reply)
Discussion started by: mbb
1 Replies

6. Shell Programming and Scripting

how to get split output of a file, using perl script

Hi, I have file: data.log.1 ### s1 main.build.3495 main.build.199 main.build.3408 ###s2 main.build.3495 main.build.3408 main.build.199 I want to read this file and store in two arrays in Perl. I have following command, which is working fine on command prompt. perl -n -e... (1 Reply)
Discussion started by: ashvini
1 Replies

7. UNIX for Advanced & Expert Users

Summing file size and output

:rolleyes:Hi, I need to find the sum of size of specific files in my directory Say for ex, mydir$ ls -ltr permisssion links user group size date time filename I want to display the sum of size of filenames having pattern "TS55". Note file size in this directory is near 400 MB. mydir$... (1 Reply)
Discussion started by: ramkrix
1 Replies

8. Shell Programming and Scripting

how can i print the output of the shell script in bigger size

how can i print the output of the shell script in bigger size eg: echo " hello world" i want to print this in the output with bigger size in the middle of the screen. can someone please help me out in that (2 Replies)
Discussion started by: mail2sant
2 Replies

9. UNIX for Dummies Questions & Answers

ls -l output file size

Hi Guys, I'm working on various platforms: Solaris 8 HP Tru64 RH Linux I'm on the HP Tru64 system and I've got to audit a particular directory for large files that are no longer being used. If I do an ls -l I get to see the file size. I'd just like to be clear on what that file size... (4 Replies)
Discussion started by: Stin
4 Replies

10. Shell Programming and Scripting

compare file size from a output file from a script

Hi guys, firstly I'm working on SunOS 5.10 Generic_125100-10 sun4u sparc SUNW,Sun-Fire-V240 I've made a script to compress two directory and then send them to an other server via ftp. This is working very well. Inside theis script I decide to log usefull data for troubleshooting in case of... (7 Replies)
Discussion started by: moustik
7 Replies
Login or Register to Ask a Question