plink truncating commands


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting plink truncating commands
# 1  
Old 11-01-2011
plink truncating commands

I'm using plink.exe on WinXP to run some commands on Z/OS BASH. My commands are interspersed with echo commands so that I can parse the output and work out what is where.

The first hundred or so commands run fine, but then one of them gets truncated. For example:
Input:
Code:
echo :end_logdetail:
echo Job Name : TfmMigration
echo :jobinfo:

What happens:
Code:
user@host:/dev> echo :end_logdetail:
:end_logdetail:
user@host:/dev> echo Job Name : Tf
Job Name : Tf
user@host:/dev> echo :jobinfo:
:jobinfo:

I just checked where in the input file the error occurs, and it's exactly 4444 bytes in, on line 116 (so it's done 115 successful commands before it goes wrong).

The command I'm using is:
Code:
plink -batch -pw xxxx user@host < "c:\dev\telnetcmd.txt" > "c:\dev\telnetout.txt"

The telnetcmd.txt is just a DOS text file with an "exit" command at the end. p.s. can anyone tell me how I can lay out my code on separate lines?

When I preview, all the line breaks are removed. Lets see if the same happens when I click Submit...
OK fixed it - it doesn't happen in Internet Explorer, I was using Firefox to post.

Last edited by PhilHibbs; 11-01-2011 at 01:05 PM..
# 2  
Old 11-01-2011
Copy-and-paste usually works, I'm told. You could try putting it in code tags, too.

Given that I don't see an error message in that output, are you sure the code's being executed incorrectly? It could be carriage returns from your input messing it up.
# 3  
Old 11-01-2011
Definitely incorrect - the line in the script says:

echo Job Name : TfmMigration

What actually gets echoed is:

Job Name : Tf

And this only happens on one of the hundreds of identical commands in the script.

p.s. fixed the post layout by trying Internet Explorer instead of Firefox.
# 4  
Old 11-01-2011
Yes, but do you see any error messages?

Perhaps a background job has printed output right in the middle of this, causing the broken line.

Without seeing what your script actually is it's difficult to tell anything at all.
# 5  
Old 11-01-2011
No, there's no error message, just one of the commands gets truncated. My script is now slightly different and it's going wrong in the same way in a slightly different place, now line 109 byte offset 4289. Here is a snip around where it goes wrong:

Code:
echo :end_logsum:
echo Job Name : SrcVRMigrationExtractUKAddress.442
echo :jobinfo:

gives this:
Code:
hibbsph@cs-uat-etl02:/software/opt/IBM/InformationServer/Server/DSEngine> 
hibbsph@cs-uat-etl02:/software/opt/IBM/InformationServer/Server/DSEngine> echo :end_logsum:
:end_logsum:
hibbsph@cs-uat-etl02:/software/opt/IBM/InformationServer/Server/DSEngine> 
hibbsph@cs-uat-etl02:/software/opt/IBM/InformationServer/Server/DSEngine> echo Job Name : SrcVRMigrationExtractUKAddres
Job Name : SrcVRMigrationExtractUKAddres
hibbsph@cs-uat-etl02:/software/opt/IBM/InformationServer/Server/DSEngine> 
hibbsph@cs-uat-etl02:/software/opt/IBM/InformationServer/Server/DSEngine> echo :jobinfo:
:jobinfo:
hibbsph@cs-uat-etl02:/software/opt/IBM/InformationServer/Server/DSEngine>

The "...Address.442" echo command has been truncated at "...Addres", some others are being truncated also.

For example, later on in the script:

Code:
echo :end_logsum:
echo Job Name : TfmVotersRollMigration.442
echo :jobinfo:

gives this:

Code:
hibbsph@cs-uat-etl02:/software/opt/IBM/InformationServer/Server/DSEngine> 
hibbsph@cs-uat-etl02:/software/opt/IBM/InformationServer/Server/DSEngine> echo :end_logsum:
:end_logsum:
hibbsph@cs-uat-etl02:/software/opt/IBM/InformationServer/Server/DSEngine> 
hibbsph@cs-uat-etl02:/software/opt/IBM/InformationServer/Server/DSEngine> echo Job Name : TfmVotersRollMigration.442
Job Name : TfmVotersRollMigration.442
hibbsph@cs-uat-etl02:/software/opt/IBM/InformationServer/Server/DSEngine> 
hibbsph@cs-uat-etl02:/software/opt/IBM/InformationServer/Server/DSEngine> echo :
:
hibbsph@cs-uat-etl02:/software/opt/IBM/InformationServer/Server/DSEngine>

This time it's the "echo :jobinfo:" that is being truncated to "echo :".

Later on, an echo command is truncated to just "ec" with an error message:

Code:
hibbsph@cs-uat-etl02:/software/opt/IBM/InformationServer/Server/DSEngine> ec
If 'ec' is not a typo you can run the following command to lookup the package that contains the binary:
    command-not-found ec
-bash: ec: command not found

This could be very dangerous if, for example, I did "rm *.bak" and it got truncated to "rm *"!

---------- Post updated at 04:58 PM ---------- Previous update was at 04:20 PM ----------

OK, I think I've resolved it... I have switched from using < to feed the script in, to using plink's -m "c:\dev\telnetcmd.txt" command line option.

Last edited by PhilHibbs; 11-01-2011 at 01:57 PM..
This User Gave Thanks to PhilHibbs For This Post:
# 6  
Old 11-01-2011
We can't even trust < in Windows CMD? Yikes! Smilie That is very strange, and very useful to know.
# 7  
Old 11-07-2011
Quote:
Originally Posted by Corona688
We can't even trust < in Windows CMD? Yikes! Smilie That is very strange, and very useful to know.
This is the only time I've ever known a program to miss out data passed in with the < operator so I suspect that this is something unusual that plink is doing with its input.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

How to avoid truncating in ps output ?

Hello, This is Solaris 10 (x86) bash-3.2# cat /etc/release Solaris 10 5/09 s10x_u7wos_08 X86 Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms. Assembled 30 March... (5 Replies)
Discussion started by: solaris_1977
5 Replies

2. Shell Programming and Scripting

Need help on Plink

Hi All, Iam a newbie to the plink and need your assistance. I have referred some posts but it doesn't helps me much. I have two steps to do. 1. I have a config file which has a list of servers,username and password. 2. I have a shell script in windows which accepts arguments and need to... (0 Replies)
Discussion started by: cskumar
0 Replies

3. Shell Programming and Scripting

Plink (processing multiple commands) using Bash

I'm completely brand new to bash scripting (migrating from Windows batch file scripting). I'm currently trying to write a bash script that will automatically reset "error-disabled" Cisco switch ports. Please forgive the very crude and inefficient script I have so far (shown below). It is... (10 Replies)
Discussion started by: MKANET
10 Replies

4. Shell Programming and Scripting

nawk is truncating output

Legends, I have 2 files f1 and f2. when i use nawk to compare the difference(subtraction) from 4th column of the file, it truncates the output. can you please help to resolve this. subtraction is (4th col of f1 - 4th col of f2). but it gives only below lines out of 116. I want to print all... (7 Replies)
Discussion started by: sdosanjh
7 Replies

5. Shell Programming and Scripting

PLINK help

Hi Plink users, I am very new in GWAS and decided to use PLINK for this. But I am struggling with file formats. I have one exome data with 200000 SNPs in it. But it is in .txt format. But all the necessary fields are there in different columns. Can you please suggest me how I can create the... (5 Replies)
Discussion started by: smitra
5 Replies

6. Shell Programming and Scripting

Truncating a mail file

Hi, I have a Unix mail file that I need to truncate, based on the date of the messages. For those not familiar with the format, it is a single file for each user, with the first line of the mail message looking like the following: From user@sitename.com Thu Apr 21 05:40:33 2011 Each... (3 Replies)
Discussion started by: joed
3 Replies

7. Shell Programming and Scripting

How we can use plink?

Hi, How we can use use plink to access unix system using Dos. Could someone send me the commands that can be use in Batch file to call unix system using plink utility. Thanks in advance (0 Replies)
Discussion started by: shekhar_ssm
0 Replies

8. UNIX for Dummies Questions & Answers

Truncating the last character

Hi all , I am creating the file which holds the create query to run in the sql prompt: so when i am creating: create table XXX( SD Varchar2(10), DF Varchar2(10),) I am getting one comma at the last ,before i am inserting the closing bracket i need to delete that? kindly provide me the... (1 Reply)
Discussion started by: ithirak17
1 Replies

9. Shell Programming and Scripting

Truncating a variable

I have a variable that is a full path name and I just want the file name with out the extension. I have figured out how to do this using some temp files but I would really like to avoid that if possible. I know I can do echo ${TMPNAME%.*} to drop the extension is there a similar way to drop... (3 Replies)
Discussion started by: whdr02
3 Replies

10. UNIX for Dummies Questions & Answers

`ps` command truncating text

I have some processes that show a long file path as part of the process name and the process name gets truncated off. Does anyone know how to get the full output from the `ps`command so that I can see the whole process name? (9 Replies)
Discussion started by: keelba
9 Replies
Login or Register to Ask a Question