Need a Script to read the contents in the file on Linux box
HI
I need help on developing 2 scripts as mentioned below.
One way process ->
We can get files of 01, 02, 07 record types (Here we need to keep a filter to read the first 2 characters in the file and if they are equal to 01 or 02 we need to do the below process and if its 07 we need to send the file as it is to a folder)
Scenario - 01:
In the file we received it would have only a single line with 300 bytes length, example below,
01 - first field indicates record type
NCX004HTXW - second field
000005241 - third field - so here we want to make this 10 characters data to 30 characters just adding 20 spaces to this third field.
When we add 20 spaces to the 3rd field the length of record becomes 320 bytes , so we need to trim last 20 characters to make length to 300 bytes.
Response process:
From our backend we may get record types like 11,17,E1,E2,12,13,14 ((Here we need to keep a filter to read the first 2 characters in the file and if they are equal to 11,17,E1,E2 we need to do the below process and if its 12,13,14 we need to send the file as it is to a folder)
Scenario - 11 :
In the file we received it would have only a single line with 600 bytes length, example below, file attached (00567538.001)
11 - first field indicates record type
NCX006QHL7 - second field
000005241 - third field - so here we want change 30 characters data to 10 characters ( by trimming the data which is coming from position 23 - 43 bytes (total 20 characters))
When we trim 20 spaces to the 3rd field the length of record becomes 580 bytes , so we need to add 20 spaces to the end of the file to make length to 600 bytes.
Moderator's Comments:
Please use CODE tags; without them it is impossible to determine the number of spaces between fields and at the end of a line.
Last edited by Don Cragun; 09-26-2013 at 05:29 AM..
Reason: Title has been kept more descriptive
Hello my dear friends,
Two file are auto generated from mon - fri at different directories on same windows box.Every day i have to copy the file, rename it (specific name)and ftp it to linux box specified directory.
is it possible to automate this process,If yes this has to be done from windows... (1 Reply)
Team,
Presently I have a script, which i have set up cron on one of my Jump-boxes,and gives me the output on every hourly basis,fetching the data from the remote machine.Basically it gives me the list of all active users logged and its count once we execute the script.Here the count is... (6 Replies)
Hello! We currently use a SecureCRT .vbs script which automates logging into multiple boxes to run a few commands. However, I'd like to have something run in Linux vs. our emulator. Below is my objective :):
Our current .vbs script will look at an IP list .txt file on our PC, then login to... (1 Reply)
Hi
I have a linux box and need to access from windows graphically
# uname -a
Linux pc-l416116 2.6.18-155.el5 #1 SMP Fri Jun 19 17:06:47 EDT 2009 i686 i686 i386 GNU/Linux
What components do I need to install on Linux and windows to do that?
TIA (6 Replies)
Hi,
I've been able to mount my linux box to a windows machine, but I can't seem to mount my linux box to another linux box I have. (I know I could scp, but for other reasons I need to do it this way) Samba is installed.
Here is an example where I mount to a Win machine.--> works fine
mount... (12 Replies)
Hello all !
I'm trying to write a shell script (bash) to ftp a file starting with particular name like "Latest_" that is present on a Windows box to UNIX server. Basically I want to set this script in the cron so that daily the new build that is posted on the Windows box can be downloaded to the... (2 Replies)
I need to execute a shell script on a remote linux box. But the shell script resides on the local linux box where I am currently logged in. Is there a way to do this? I know rsh <host> <command> can execute a command on the remote host. (6 Replies)
Hi all,
i have a perl script one server. I am running a cronjob to execute my perl script.
#! /usr/bin/perl
...
...
...
#call a shell script on another server How can i accomplish #?
Do i have to issue a system (" ssh -l username server | shellscript.sh") in my shell script? or is there a... (1 Reply)
HI All,
I need a script to reboot a linux box from a windows box.
The script needs to run automatically whenever a sitescope alerts with an error message.
Have searched for this in the forums, but could not get something relative.
Pls. let me know the various alternatives we have to do... (2 Replies)