Sponsored Content
Full Discussion: Help !! perl open function
Top Forums Shell Programming and Scripting Help !! perl open function Post 302523327 by dynamax on Wednesday 18th of May 2011 12:16:54 PM
Old 05-18-2011
Help !! perl open function

Help Please perl Gurus,

I am trying to add ungrouped passengers in a group and I creating a script however it fails on first step only I tried all the options it returns following error.

syntax error at junki line 4, near "open "
Execution of junki aborted due to compilation errors.
at junki line 14

Here is my code
Code:
#!/usr/bin/perl -w 
$bookid = 3456 
 
open (LSOUT, "res_list -avail -bookid $bookid |" ); 
while ($LINEINc = <LSOUT>) 
{ 
  chomp ($LINEINc); 
  if ( $LINEINc =~ "no/name") 
  { 
    print "$passid\n"; 
  } 
} 
close (LSOUT); 
exit;

Usually I use following commands to do it manually.
Code:
# res_list -avail 
ID Availability Pass Name GroupName Total Pass 
0050 booked abc xyz no/name's 8 
0051 booked abc xyz roth 8 
0052 booked abc xyz no/name's 8 
0053 booked abc xyz no/name's 8 
0054 booked abc xyz bengal 9 
0055 booked abc xyz no/name's 9 
0056 booked abc xyz brown 9 
0057 booked abc xyz no/name's 9 
0058 booked abc xyz eagle 9 
0059 booked abc xyz no/name's 9 
005A booked abc xyz no/name's 9

select only 3 ID's where group name is noname and list them in a comma saperated format like 0050,0052,0053....

then run following command to make sure they are not member any other groups.
Code:
#search_grp -passid 0050,0052,0053 

ID Group Name Pass. Count loc Count 
---- -------------------------------- ----- ----- 
0050 - - - 
0052 - - - 
0053 - - -

if they are not member of any group then print in the following format in file - name grpid_class
Code:
create group ID 0050, class=leisure; 
copy id 0052 to group id 0050; 
copy id 0053 to group id 0050;

once they are displayed to user run the file in following command
Code:
#create_group -f 0050_leisure

succuessful display message.

Last edited by Scott; 05-18-2011 at 04:34 PM.. Reason: Code tags, please...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

function to test if file is open

I need to write a function that will work in sh/ksh shell that will test to see if a file has already been opened for writting by another user has anyone written something like this? (3 Replies)
Discussion started by: johnsonbryce
3 Replies

2. Shell Programming and Scripting

perl window.open without blocker

Hi Everyone, We know that when we open a popup window, if my IE, Yahoo tool bar enable the popup-blocker, then my window will be blocked. like my code. print <<EOD; <script language=JavaScript> var s = new String(window.location.href); if (s.match(/Start/)){ ... (3 Replies)
Discussion started by: jimmy_y
3 Replies

3. UNIX and Linux Applications

Sybase help: Open client, bcp function

To begin: I use Linux The Problem: I need bcp functionality for scripts. Perl modules, such as Sybase:xfer, require ctlib which comes with Sybase Open Client. Talking with Sybase sales reps is an exercise in futility and hate. They know absolutely nothing about their own products and will... (0 Replies)
Discussion started by: Bubnoff
0 Replies

4. Programming

Open function of sys/stat.h

If a process already has the entire file locked for read and write using newstruct.l_type = F_WRLCK; what would happen if another process would try to open it in read only mode using open(filename, O_RDONLY); ? I want to check if the file exists and I want it to work even if another process has... (4 Replies)
Discussion started by: cyler
4 Replies

5. Shell Programming and Scripting

Unable to open a file in perl

Not able to open a file using this code why not? use strict; use warnings; my $file = "verInfo.txt"; unless(open FILE, $file) { # Die with error message # if we can't open it. die "\nUnable to open $file\n"; } my $line = <FILE>; print $line; close FILE; (7 Replies)
Discussion started by: srijith
7 Replies

6. Shell Programming and Scripting

open a webpage through perl script

Hi All Can anyone please help me how to open a webpage suppose(Google) with the help of perl script and refresh it after every 5 minutes. (0 Replies)
Discussion started by: parthmittal2007
0 Replies

7. Shell Programming and Scripting

PERL - issue with OPEN

Hi, I have a menu script written in PERL which calls some shell scripts and displays the return. I'm having a problem with OPEN. A section of the code is below: `./scriptlist.ksh 1`; open OUTPUT, "</home/$SCRIPTUSER/output"; { local $/ = undef; $_ =... (2 Replies)
Discussion started by: chris01010
2 Replies

8. Programming

Function open() sets errno

I am opening a text file using open() system call in O_RDONLY mode. open() returns me a valid handler but also sets errno to 13 i.e. EACCES(Permission denied). Question is when open() is returning a valid handler then why does it sets the errno? Should not errno be set only in case of error... (10 Replies)
Discussion started by: rupeshkp728
10 Replies

9. Shell Programming and Scripting

Open file function

Hello all, just a quick little part of code i'm writing to check if the file i'm writing too in my automatic process is not being written too manually. #!/bin/bash FUSER=$(/sbin/fuser -s /toto.tmp >/dev/null 2>&1) LSOF=$(/usr/sbin/lsof | grep -q "toto.tmp") PGREP=$(pgrep -f "toto.tmp" >... (6 Replies)
Discussion started by: maverick72
6 Replies

10. Shell Programming and Scripting

Converting shell to Perl I run into shell built in function trap and need alternative in Perl

I am working on converting shell to Perl script. In shell we have built in function trap Do you know alternative in Perl or actually we don't need it? Thanks for contribution (3 Replies)
Discussion started by: digioleg54
3 Replies
rate.conf(5)							   isdnlog 4.71 						      rate.conf(5)

NAME
/etc/isdn/rate.conf - rate and provider configuration DESCRIPTION
isdnlog and related programs like isdnrep or isdnrate obtain the information about telephone rates or fees from a rate-file. In addition to the general data from the rate-file it is necessary to provide information about the individual situation. This is the purpose of the configuration file rate.conf. Words below consisting of uppercase letters like RATEFILE refer to the so named setting in the general isdnlog configuration file /etc/isdn/isdn.conf. General Concepts The rate-file contains one or more providers for a country. A provider covers an offer of a telephone company. Usually there are now many telephone companies in a country and most companies offer several different price lists. A provider is identified by provider number and provider variant or sub number. The provider number, short pnum, is commonly used for all offers of one company. The provider variant, short var, is used to number these offers starting from 0. A specific provider is referenced as pnum,var or pnum_var depending on the context. VBN contains the shared leading digits of the carrier selection prefixes. The entire prefix for a provider is specified in the rate-file by the B: tag. In Germany the carrier selection prefix begins with 010 followed by two or three digits which make the pnum ranging from 10 to 199. A mapping like this is not required but common. The overall format of rate.conf is similar to the rate-file, lines starting with tags P:, X:, or Q: may occur in any order and quantity. (Of course, the resulting configuration should make sense.) Provider Booking P:pnum=var Mark the provider specified by pnum and var as booked or active. Only booked providers are taken into account when isdnlog computes the connection costs. Booking also tells isdnlog the provider variant to use if there are more than one. Beside computation of real connections booking also splits the providers in two groups: the booked ones that are available at the specific subscriber line at the not booked ones that are less important for price comparison. One provider in booked group is declared the default provider by setting PRESELECTED to its pnum. This provider is assumed to be used if a connection is made without a carrier selection prefix and no exceptions matching. Exceptions to Provider Selection X:number=pnum X:number=pnumzzone Connections to number will be assigned the booked provider with pnum as provider number regardless of a dialed provider selection prefix or the PRESELECTED setting. zone if present replaces the normal zone selection based on destination codes. Exceptions can also be given in the rate-file. In rate.conf exceptions may become necessary if there different preselected providers for local and distance calls for example or if prese- lection does not apply generally, e.g. not for connections to special numbers. Provider Skipping At least for some countries there are universal rate-files distributed with isdnlog or provided elsewhere. In this case it is desirable to keep the rate-file unmodified so that updates require no further changes beyond installing the new rate-file. If a rate-file aims to cover the telephone market in an entire nation there will be always providers in it which are not available or not suitable for a specific installation. Such providers can be disabled by not booking them but they remain present and may be displayed as overall cheapest provider or the like. Provider skipping completely ignores selected, so called skipped providers, from the rate-file. To be more precise, the effect of skipped provider could also be achieved by deleting its lines starting from its P: tag to the last line before the P: tag of the next provider from the rate-file. Providers to skip can also be configured in the parameter file of isdnlog using the syntax described below in a line starting with skip- Prov= instead of Q:. Q:[!|~]list list := range[;list] range := (*|prov|prov-|-prov|prov-prov)[!|~] prov := pnum[,var] Skipping applies to all providers that are matched by a given range. If var is missing, all providers with pnum are skipped. * matches all providers. Booked providers are not skipped unless ! is given at end of the range or in front of the entire list where it applies to whole line. The ~ can be given alternatively to !. Providers that match such a range are not skipped under any circumstances. Space can occur anywhere in the line after Q:. Example: Q:*; 13,1~; 33-33,1~; 200-299!; 321-323! This skips all not booked providers except 13_1, 33_0, and 33_1. Additionally all providers with a pnum between 200 and 299 or 321 and 323 are skipped. FILES
/etc/isdn/rate.conf This file. RATECONF may be used to specify an alternative rate and provider configuration file. /usr/share/isdn/rate-CC.dat The rate-file for your country. Replace CC with your two letter country code, e.g. de for Germany. RATEFILE defines the rate-file to use. AUTHOR
Tobias Becker <tobiasb@isdn4linux.de> SEE ALSO
isdnlog(8) rate-files(5) isdn.conf(5) ISDN 4 Linux 3.13 2007/01/05 rate.conf(5)
All times are GMT -4. The time now is 01:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy