perl - problem sending text with delimiter


 
Thread Tools Search this Thread
Top Forums Programming perl - problem sending text with delimiter
# 1  
Old 08-26-2010
perl - problem sending text with delimiter

Hello,

i encountered this in perl but it might be command line related as well:
i am sending text as an argument to echo command on remote computer.
if the text has alphanumeric characters only, say 'hello world' all is well. if however text has metacharachters, e.g. 'hello | world' or even worse hello '|' world' i get : 'world' is not recognized as internal or external command.
tried many options but cannot find my way around this.
any ideas?

thnx
# 2  
Old 08-26-2010
The text is being fed into a shell of some sort, and needs proper quoting to avoid messing up on special characters. Can we see your code?
# 3  
Old 08-27-2010
i am using psexec (on windows) for remote activity:
Code:
my $text = "Hello | world";

my @args = (`psexec \\\\$IP -U $USER -P $PSWD C:\\Temp\\cmdutils\\echo $text > \\\\193.168.2.12\\$g\\LoadEXKBT\\WorkFiles\\SrcFileName_$table.txt `);
system(@args);

(without | or ' all is good )

thnx again

---------- Post updated at 10:52 AM ---------- Previous update was at 09:48 AM ----------

ok, i solved the problem. using qq("'|'") made it work.

thanx

Last edited by pludi; 08-28-2010 at 03:25 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl Code to change file delimiter (passed as argument) to bar delimiter

Hi, Extremely new to Perl scripting, but need a quick fix without using TEXT::CSV I need to read in a file, pass any delimiter as an argument, and convert it to bar delimited on the output. In addition, enclose fields within double quotes in case of any embedded delimiters. Any help would... (2 Replies)
Discussion started by: JPB1977
2 Replies

2. Shell Programming and Scripting

Shell script to put delimiter for a no delimiter variable length text file

Hi, I have a No Delimiter variable length text file with following schema - Column Name Data length Firstname 5 Lastname 5 age 3 phoneno1 10 phoneno2 10 phoneno3 10 sample data - ... (16 Replies)
Discussion started by: Gaurav Martha
16 Replies

3. UNIX for Dummies Questions & Answers

Remove text in particular delimiter

I have input file like this 551|552|553|554|555|556|557|558|559|560 I need any one offset need to be blank for eg. 551|552|553||555|556|557|558|559|560 My Shell is csh (1 Reply)
Discussion started by: nsuresh316
1 Replies

4. Shell Programming and Scripting

Problem with sending email(to include contents of text file)

Hello, I was using a shell script for sending contents of a text file(email.report) to different users. I was using the below command in my script to send email... cat email.report | /usr/bin/mailx -s $REQ_SUBJECT -h 5 abc@xyz.com It was working fine all these days but now all of a sudden it... (18 Replies)
Discussion started by: smarty86
18 Replies

5. Shell Programming and Scripting

Extract 2 or more int from the text with delimiter.

Hi All, I want to extract the integers from the each line, each line may have 2 or more integers. The following command is appending each integers. echo "Hi I am 100, my friend is 500, his friend is 423" | sed "s///g" 100500423 I need to have delimiter "|" between the integers. If anyone... (18 Replies)
Discussion started by: sarwan
18 Replies

6. Shell Programming and Scripting

Adding a delimiter to a text file

Im writing a KSH script to read a simple text file and add a delimiter. Ive written the following script but it runs very slow. I initially used the cut command to substring the input record then switched to this version using awk to substring... both run too slow. Any ideas how to make this more... (2 Replies)
Discussion started by: lock
2 Replies

7. Shell Programming and Scripting

Problem sending excel attachments with MIME::Lite in perl

I am running a perl script that generates an excel doc and then emails it as an attachment. I can generate the excel file fine. I can scp it from the box and open it with no problems. When I send it over email, the file does open properly. The file in email is only 288 B, but on the server it is... (1 Reply)
Discussion started by: Mike_the_Man
1 Replies

8. Shell Programming and Scripting

PERL: Searching for a string in a text file problem

Looking for a bit of help. I need to search for a string of words, but unfortunately these words are located on separate lines. for example the text output is: United Chanmpions Ronaldo Liverpool Losers Torres and my script code is print("DEBUG - checking file message"); while... (15 Replies)
Discussion started by: meevagh
15 Replies

9. Shell Programming and Scripting

Insert text between delimiter

Can someone help me on this? I'm creating an Insert stmt script but Oracle does not accept blanks values. How can I insert the word null between two commas? I'm guessing awk or sed. Is there a good post or site with easy to understand info on awk and sed? I'm really new to unix scripts :D ... (5 Replies)
Discussion started by: ystee
5 Replies

10. Shell Programming and Scripting

How delimiter in text files..urgent!!! please

hi, I want the result just date,time,%loss, and average. I stored the results of ping test in text files. How can I grep all of them and keep the result in another file ? this is example: Mon 04/03/2006 12:00 AM Pinging 01.123.213.36 with 32 bytes of data: Reply from 01.123.213.36:... (1 Reply)
Discussion started by: bjsellt
1 Replies
Login or Register to Ask a Question