Sponsored Content
Full Discussion: Perl: Reading in reverse.
Top Forums Shell Programming and Scripting Perl: Reading in reverse. Post 302364282 by Scrutinizer on Thursday 22nd of October 2009 01:49:22 PM
Old 10-22-2009
Do you have tac?
Code:
$> cat infile
     Mr. Praline: I'm sorry, I have a cold. I wish to make a complaint!
     Owner: We're closin' for lunch.
     Mr. Praline: Never mind that, my lad. I wish to complain about this parrot what I purchased not half an hour ago from this very boutique.
     Owner: Oh yes, the, uh, the Norwegian Blue...What's,uh...What's wrong with it?
     Mr. Praline: I'll tell you what's wrong with it, my lad. 'E's dead, that's what's wrong with it!
     Owner: No, no, 'e's uh,...he's resting.
$> tac infile
     Owner: No, no, 'e's uh,...he's resting.
     Mr. Praline: I'll tell you what's wrong with it, my lad. 'E's dead, that's what's wrong with it!
     Owner: Oh yes, the, uh, the Norwegian Blue...What's,uh...What's wrong with it?
     Mr. Praline: Never mind that, my lad. I wish to complain about this parrot what I purchased not half an hour ago from this very boutique.
     Owner: We're closin' for lunch.
     Mr. Praline: I'm sorry, I have a cold. I wish to make a complaint!

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl Reading from File

is there a perl equivalent to sscanf? or something where I get the strings separated by spaces? (1 Reply)
Discussion started by: karyn1617
1 Replies

2. Shell Programming and Scripting

perl not reading my variable

I'm trying to make changes in a file using the following bash script: #!/bin/bash MYHOME=`echo $HOME` README=$MYHOME"/environment" IAM=`whoami` CHANGEPATHLIST="TALOG TACONFIG TAINFO TAWORK TMPSPACE" for var in $CHANGEPATHLIST do perl -pi -e 's/sacuser1/$IAM/ if m/$var/' $README... (3 Replies)
Discussion started by: yoonixq4u
3 Replies

3. Shell Programming and Scripting

PerL Reverse the string.

Hi, I am very new to perl. My question: How i can reverse the given string using substr function but without using reverse function in perl? Anybody please help. thanks, -Lalit (3 Replies)
Discussion started by: email-lalit
3 Replies

4. Shell Programming and Scripting

perl - reading from a file conditionally

Hi, I am new to perl. I want to read from a file on the basis of some conditions.. I want to define parameters in a configuration file in such a manner like... etc.. in my perl script, theer is a variable like this.. then i want to read values from first if block from the file... (1 Reply)
Discussion started by: shellwell
1 Replies

5. Shell Programming and Scripting

Perl - Reading keyboard keystroke

Hello All, I wounder if any one know if perl have the ability to run script in the background which record each keyboard keystorke? If yes , how can I implement the part which reading the keyboard keystroke? Is there any moudle that handle it ? Thanks a head Alalush (1 Reply)
Discussion started by: Alalush
1 Replies

6. Shell Programming and Scripting

Reading values in perl

Hi whats the easiest way to read data from a feed file? sample data in a file called data.txt: name = varun ip = '23.43.123.2' address = "asd, blah blah blah ..... @#!$%$#%" i want to use this data in a perl script. I thought of initially reading it line by line n then cutting... (7 Replies)
Discussion started by: VGR
7 Replies

7. Shell Programming and Scripting

Perl: Reading data from other file

Hi, I am writting some perl scripts for daily backup process. In which I want to pass some data/referance from another txt file. Text file contains only one column and multiple rows. I want to pass this data to variables of another perl script. e.g. Refdoc.txt file contains data as: perl1... (3 Replies)
Discussion started by: n.dba
3 Replies

8. UNIX for Dummies Questions & Answers

reading a file in Perl

If a form's action is the following Perl script how do I make it print the entire contents of the file on the screen? if(param()) { my $uploadedFile = param('file');#in the html page 'file' is the value of the name attribute of the input my $fh = upload($uploadedFile); ... (1 Reply)
Discussion started by: zerohour
1 Replies

9. Shell Programming and Scripting

for loop - reverse reading

All, Here is my for loop export CFGLIST="LIST1 LIST2 LIST3" for i in $CFGLIST do echo print $i done The output will be LIST1 LIST2 LIST3 But i want it display LIST3 LIST2 LIST1 (8 Replies)
Discussion started by: baluchen
8 Replies

10. Shell Programming and Scripting

Perl :: reading values from Data Dumper reference in Perl

Hi all, I have written a perl code and stored the data into Data structure using Data::Dumper module. But not sure how to retreive the data from the Data::Dumper. Eg. Based on the key value( Here CRYPTO-6-IKMP_MODE_FAILURE I should be able to access the internal hash elements(keys) ... (1 Reply)
Discussion started by: scriptscript
1 Replies
TacacsPlus(3pm) 					User Contributed Perl Documentation					   TacacsPlus(3pm)

NAME
Authen::TacacsPlus - Perl extension for authentication using tacacs+ server SYNOPSIS
use Authen::TacacsPlus; $tac = new Authen::TacacsPlus(Host=>$server, Key=>$key, [Port=>'tacacs'], [Timeout=>15]); or $tac = new Authen::TacacsPlus( [ Host=>$server1, Key=>$key1, [Port=>'tacacs'], [Timeout=>15] ], [ Host=>$server2, Key=>$key2, [Port=>'tacacs'], [Timeout=>15] ], [ Host=>$server3, Key=>$key3, [Port=>'tacacs'], [Timeout=>15] ], ... ); $tac->authen($username,$passwords); Authen::TacacsPlus::errmsg(); $tac->close(); DESCRIPTION
Authen::TacacsPlus allows you to authenticate using tacacs+ server. $tac = new Authen::TacacsPlus(Host=>$server, Key=>$key, [Port=>'tacacs'], [Timeout=>15]); Opens new session with tacacs+ server on host $server, encrypted with key $key. Undefined object is returned if something wrong (check errmsg()). With a list of servers the order is relevant. It checks the availability of the Tacacs+ service using the order you defined. Authen::TacacsPlus::errmsg(); Returns last error message. $tac->authen($username,$password,$authen_type); Tries an authentication with $username and $password. 1 is returned if authenticaton succeded and 0 if failed (check errmsg() for reason). $authen_type is an optional argument that specifies what type of authentication to perform. Allowable options are: Authen::TacacsPlus::TAC_PLUS_AUTHEN_TYPE_ASCII (default) Authen::TacacsPlus::TAC_PLUS_AUTHEN_TYPE_PAP Authen::TacacsPlus::TAC_PLUS_AUTHEN_TYPE_CHAP ASCII uses Tacacs+ version 0, and will authenticate against the "login" or "global" password on the Tacacs+ server. If no authen_type is specified, it defaults to this type of authentication. PAP uses Tacacs+ version 1, and will authenticate against the "pap" or "global" password on the Tacacs+ server. CHAP uses Tacacs+ version 1, and will authenticate against the "chap" or "global" password on the Tacacs+ server. With CHAP, the password if formed by the concatenation of chap id + chap challenge + chap response There is example code in test.pl If you use a list of servers you can continue using $tac->authen if one of them goes down or become unreachable. $tac->close(); Closes session with tacacs+ server. EXAMPLE
use Authen::TacacsPlus; $tac = new Authen::TacacsPlus(Host=>'foo.bar.ru',Key=>'9999'); unless ($tac){ print "Error: ",Authen::TacacsPlus::errmsg()," "; exit(1); } if ($tac->authen('john','johnpass')){ print "Granted "; } else { print "Denied: ",Authen::TacacsPlus::errmsg()," "; } $tac->close(); AUTHOR
Mike Shoyher, msh@corbina.net, msh@apache.lexa.ru Mike McCauley, mikem@open.com.au BUGS
only authentication is supported only one session may be active (you have to close one session before opening another one) SEE ALSO
perl(1). perl v5.14.2 2012-01-17 TacacsPlus(3pm)
All times are GMT -4. The time now is 09:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy