473,320 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to pass commands in Perl script?

Hi All,

I'm new to perl and still learning.
I'm having few files in a unix server which are actually in un-readable format. Those files are generated by some COBOL programs and those files are of RECORD TYPE 31.

Normally we used to give below command manually to read these files in the Unix server.

> irs "filename"

Then it will open vi editor and will display the file in readable format (TXT format). Then we are passing ":q!" to come out of this editor. After this a text file will be generated in the directory which is what we need.

Now I want to implement these steps using perl script. I tried using system() and backticks`` to do this, but the perl script is waiting for the quitr command to get out of that vi editor. Please help me in how to pass those commands through perl script.

Expand|Select|Wrap|Line Numbers
  1. #!/usr/local/bin/perl
  2. use File::Copy;
  3. @outarray = ();
  4. @outarray = `ls \*.INT.\*`;
  5. print "@outarray \n";
  6. foreach $outint (@outarray){
  7. system("irs $outint");
  8. }
  9. exit;
  10.  
When I execute this script, it is opening vi editor and I can able to see the readable format of the file, but I should give quit command manually to come out of that, but I need that to be done through script.
Let me know if any details required from my end.
Oct 1 '15 #1
1 2381
Hi All,
Can any one help me in this please?
Oct 5 '15 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Wet Basement | last post by:
I am passing data to a putcart.pl , parsing it, then building the query string to put the item in the shopping cart: $cartStr =...
3
by: FLOTServer | last post by:
Here's my problem: I run a gameserver that runs the game "Medal of Honor". On the game server is log file which contains all of the data from the players for that day (kills, deaths, etc...). I...
9
by: 8anos | last post by:
Hello, I am new at the community and newbie at programming :) As you may know rapidshare provides a perl script for linux, to upload files at their servers. You can find the original scripts at...
5
by: rahulthathoo | last post by:
Hi. I need to develop a web based application which uses php for the front end and statistical manipulations in perl - my question is - how do i call a perl script from php - i guess the answer...
3
by: bossingdarwin | last post by:
Hi Guys, I'm new to Perl and to this forum and I hope you gurus here help me. I am building a perl script that will telnet to one of my cisco router and execute commands. I was able to do this...
24
by: Peter Michaux | last post by:
I have a Perl script that I want to run as a set-user-ID program. Many OSes don't allow scripts run as set-user-ID. To make this script portable, it seems I need to write a C wrapper program that...
82
by: happyse27 | last post by:
Hi All, I modified the user registration script, but not sure how to make it check for each variable in terms of preventing junk registration and invalid characters? Two codes below : a)...
5
by: rsetty | last post by:
Hi All, I have a requirement to run a set of commands through PERL script. I am trying to execute a set of commands through PERL which need to be executed in a seperate command prompt. I am...
1
by: sai prudvi | last post by:
hi I am new to Perl and HTML . I have written a back end script in Perl using send expect statements, for loops and subroutines. In the Perl script i am logging in to the server and sending some...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.