473,385 Members | 1,325 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,385 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 2383
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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.