Sponsored Content
Top Forums Shell Programming and Scripting Problem writing to different files Post 302470067 by chriss_58 on Tuesday 9th of November 2010 06:01:13 AM
Old 11-09-2010
Problem writing to different files

Hello:

I have the following code:

----------------------------------
open (OUTPUT_FILE, ">>/usr/users/rovolis/PREPAID/CC/TCG/PP.$cyear$cmonth$cday.txt")||die "$!";
82 open (OUTPUT_FILE2, ">>/usr/users/rovolis/PREPAID/CC/TCG/PR.$cyear$cmonth$cday.txt")||die "$!";
83 # print OUTPUT_FILE (join ("|", @array), "\n");
84 # print OUTPUT_FILE2 (join ("|", @array), "\n");
85
86 #Read file line by line
87 while ( $input = <INPUT_FILE> )
88 {
89 my @field = "";
90 @row = split ('\$',$input);
91 foreach $current_row (@row)
92 {
93 if ($current_row ne '')
94 {
95 my @output_cdr=();
96 my $row_matched=0;
97
98 #split the line and store the elements into an array
99 @field = split('\,', $current_row);
100 chomp(@field);
101
102 if($field[0]== " ") #Skip empty lines
103 {
104 next;
105 }
106
107 $linesRead++;
108
109 #Rule for wap test case
110 if($field[9] eq 'postpaid')
111 {
112
113 print OUTPUT_FILE (join (",", @field), "\n");
114 }
115 else
116 {
117
118 print OUTPUT_FILE2(join (",", @field), "\n");
---------------------------------------------------------------

When i run this i get the following error:
Undefined subroutine &main::OUTPUT_FILE2 called at unrated_dls.pl line 118, <INPUT_FILE> line 1.

I do not understand since in line 82 i define OUTPUT_FILE2 handler.
Can you please help?

Best Regards,
Christos

---------- Post updated at 06:01 AM ---------- Previous update was at 05:58 AM ----------

I found the problem, please do not bother with this issue.

Thank you!
 

10 More Discussions You Might Find Interesting

1. HP-UX

Problem in HP-Unix while writing into socket

Our system is having a server and multiple clients. We are monitoring the client FDs using select() system call in HP-UX. After establishing connection-using socket with the remote client, before start sending the data we are checking the status of socket using select( ) call. For first 16... (0 Replies)
Discussion started by: AshokG
0 Replies

2. UNIX for Dummies Questions & Answers

Problem with writing a program

Hi guys I'm having trouble with trying to create a script which calculates the grade of a student and the marks out of 300. The grades are: 0-49% fail 50-59% pass 60-69% credit pass 70-79% distinction 80-100% high distinction less than 0 or greater than 100 displays error message. My... (1 Reply)
Discussion started by: CompNoob
1 Replies

3. Programming

very bizzare file writing problem

I'm trying to write a function which opens a file pointer and writes one of the function parameters into the file, however for some reason Im getting a core dump error. The code is as below void WriteToFile(char *file_name, char *data) { FILE *fptr; /*disk_name_size is a... (10 Replies)
Discussion started by: JamesGoh
10 Replies

4. UNIX for Advanced & Expert Users

Problem while writing to a file...?

Hi, I have an issue with the file writing... It is, Suppose that if I am writing some data to a file... and at the same time another user has opened the file and want to write in to the file(writing to the file at the same time)...the another has to know that someone has opened the file, mean... (3 Replies)
Discussion started by: vijay4b7
3 Replies

5. Shell Programming and Scripting

Writing in a socket trough TCL problem.

Hello everyone: I have a script that writes and read DATA in/from a socket, but i have a great problem while writing. My socket is created in this way: set connection fconfigure $connection -encoding binary -translation binary -blocking 1 And the writer procedure is this one: ... (0 Replies)
Discussion started by: trutoman
0 Replies

6. Shell Programming and Scripting

Script writing problem

Self professed idot looking for help LOL Hi all, I am new to Unix and I have to write a shell script that will check to see if a file exist and then create it if it does not. The file I need to search for is titled "A1. dat" and here is my feeble attempt at creating the script: #!/bin/bash... (2 Replies)
Discussion started by: Tinablue
2 Replies

7. Shell Programming and Scripting

newbie: writing ksh shell problem

my default profile is using ksh, I tried to write a simple scripts and I had issues, below is my scripts: $ more if_num.ksh USAGE="usage: if_num.ksh" print -n "Enter two numbers: " read x y if ((x=y)) then print "You entered the same number twice." when I tried to executed the... (6 Replies)
Discussion started by: matthew00
6 Replies

8. Shell Programming and Scripting

Problem with writing into a file through shell script

Hi all, I have a shell script which I use to login to the server from the client and then from the server I run a bunch of other scripts to complete my task. I am having problems with the script below- #!/bin/bash while read line do connections=`echo $line | cut -d " " -f 1` period=`echo... (3 Replies)
Discussion started by: joydeep4u
3 Replies

9. Shell Programming and Scripting

Problem writing a search script

I trying to write a script in bash that take a list of users in “fileA” and searches another list user in “fileB” if the user does not exist in “file B” write the user to another file “file C”. Please note “fileA” and “fileB” contains over 1000 users Basically “fileA” “fileB” ... (2 Replies)
Discussion started by: hassan1
2 Replies

10. Shell Programming and Scripting

Problem writing/wrapping files under folder using perl

I have a script which generates env setup xml file by reading path.It read the path and checks if there is any file/dir present recurseively. If a file is found under sub directory then it will read the file and the values from the file are passed to generate xml format. Problem is if i have a... (0 Replies)
Discussion started by: Optimus81
0 Replies
gnome-open(1)							   User Commands						     gnome-open(1)

NAME
gnome-open - open a file using the appropriate application SYNOPSIS
gnome-open [gnome-std-options] URL DESCRIPTION
gnome-open opens a file from the command line by launching the appropriate application that is associated with the file mime type. OPTIONS
The following options are supported: gnome-std-options Standard options available for use with most GNOME applications. See gnome-std-options(5) for more information. OPERANDS
The following operands are supported: URL Specifies the name of the URL to open. EXAMPLES
Example 1: Opening a Text File in the Home Directory example% gnome-open README.txt ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables: NLSPATH. EXIT STATUS
The exit value 0 is returned regardless of success or failure. FILES
The following files are used by this application: /usr/bin/gnome-open Executable to open a file using the appropriate application ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWgnome-libs | +-----------------------------+-----------------------------+ |Interface stability |Volatile | +-----------------------------+-----------------------------+ SEE ALSO
Latest version of the GNOME Desktop User Guide for your platform. attributes(5), environ(5), gnome-std-options(5) NOTES
Written by Stephen Browne, Sun Microsystems Inc., 2004. SunOS 5.11 6 Sep 2004 gnome-open(1)
All times are GMT -4. The time now is 04:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy