Remotely executing awk command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Remotely executing awk command
# 1  
Old 07-14-2007
Remotely executing awk command

ssh user@machine awk '{ split ($1,ar,"!");print ar[2]}' samp >samp1

Error:
Unmatched '.

However on <machine> awk '{ split ($1,ar,"!");print ar[2]}' samp >samp1
executes successfully.

Any suggestions.
# 2  
Old 07-14-2007
You need to escape the various control characters so that the string remains faithful as it goes between machines.

Alternatively pipe the command in as the stdin input rather than on the commmand line.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to execute command remotely as sudo and save the output locally?

Hello , I am trying to run a NetBackup command in remote server. Also this command can only be run by root so I am using sudo . Also I want the output of the command locally in a file. The below command asked for password , ran successfully and showed Output on my local server screen ... (2 Replies)
Discussion started by: rahul2662
2 Replies

2. Shell Programming and Scripting

Remotely Executing Shell Script - Problems

Hey Lads, I have a shell script on a remote Server X that i need to execute from Server A. the script executes fine locally but remotely does not. It appears the script on the remote machine is calling another shell script which only has an array defined . Please see below the errors. ... (10 Replies)
Discussion started by: Irishboy24
10 Replies

3. Shell Programming and Scripting

ssh execute command remotely

Hi all, Today I want to write a script to run the commands remotely. If I run the command as follows: ssh <user>@<ip> 'ls; pwd' it works fine. But when I want to use ssh to set view in clearcase, it will lose the response. as follows ssh <user>@<ip> 'cleartool setview <view_name>; pwd'... (1 Reply)
Discussion started by: Damon_Qu
1 Replies

4. Shell Programming and Scripting

Problems with remotely executing scripts

Hi, in the below command, i export a value to a variable which later is used by the script, however i dont see the exported value is actually been exported. ssh user@host "export var=/path/ ; cd /path/ ; ./script" how can i use the above command with proper value of var remotley (7 Replies)
Discussion started by: suraj.sheikh
7 Replies

5. Programming

Executing a awk command inside perl script --

Hello experts I want to execute a awk command, which reads from txt files and sums the numbers from the first column for those listed only inside a <init> block -- The awk command is like awk '/<\/?init>/{x = !x}x{a++}x && a > 2{sum+=$1}END{printf"%E" "\n", sum} So, I want to execute... (2 Replies)
Discussion started by: Alkass
2 Replies

6. Solaris

How to securely invoke a Solaris privildged command (root) remotely?

Hi, What I would like to do "securely" is the following. From one central server invoke a script that does the following. --Store user/name passwords. (password possibly encrypted in config file) --From the central server invoke a privileged command (i.e. route add) on multiple... (1 Reply)
Discussion started by: topstuff
1 Replies

7. Shell Programming and Scripting

running command remotely to populate local variable

If I run this # ssh remote-server 'du -sk /usr/platform/`uname -i`/' 174 /usr/platform/SUNW,Sun-Fire-V245 I get my output just fine, However, if i try to do the same but populate a local variable within my script called for example 'result' #!/bin/ksh result=`ssh remote-server... (3 Replies)
Discussion started by: hcclnoodles
3 Replies

8. Shell Programming and Scripting

using awk remotely

Hi there I am trying to add up the disk space used on a remote linux box but am falling at the first hurdle i.e isolating the 'space used' column with df -k on the remote box if i run this, i get the df -k output as expected # rsh remote-server 'df -k|grep sd|grep -v boot' /dev/sda3 ... (8 Replies)
Discussion started by: hcclnoodles
8 Replies

9. Shell Programming and Scripting

sudo command remotely

Hi, can any one of you help me how to run sudo commands/scripts remotely... (2 Replies)
Discussion started by: pvamsikr
2 Replies

10. Shell Programming and Scripting

Executing remotely the script

Hi All, I have a script to be executed in another machine. I connect to that machine from another server as a root ( this is the only configured access, as i cannot log in as a normal user). After that I have to switch to a normal user and that I can be able to executge that script. But all this... (12 Replies)
Discussion started by: elthox
12 Replies
Login or Register to Ask a Question