awk on a remote machine using 'rsh'


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting awk on a remote machine using 'rsh'
# 1  
Old 06-12-2008
awk on a remote machine using 'rsh'

Hi,

I want to do a awk operation on a file on a remote machine.
I am using rsh for this.

rsh <remote> awk '{print $2}' process.txt

output:

awk: syntax error near line 1
awk:illegal statement near line 1


I can do the awk operation by logging into the remote machine.

Can someone help me with this?

Thanks in advance.
Sunnny
# 2  
Old 06-12-2008
It is a quoting and escaping issue. Try this:

Code:
rsh <remote> "awk '{print \$2}' process.txt"

Unless the awk script is very simple, I suggest to create a shell script, rcp the script on the remote host and then execute the remote script with rsh.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with fetching the data from remote machine from my jumpbox(local machine)

Team, Presently i am running a script from my local box(i.e jumpbox) to all the remote machines.Basically fetching basic queries like pwd,mkdir,touch etc and i am able to successfully fetch it from my local machine.But when i want to check certain database related queries like the dbstat... (20 Replies)
Discussion started by: whizkidash
20 Replies

2. Red Hat

iptables applied in local machine, can't ssh remote machine after chain changed to DROP

I want to SSH to 192.168.1.15 Server from my machine, my ip was 192.168.1.99 Source Destination was UP, with IP 192.168.1.15. This is LAN Network there are 30 Machine's Connected to the network and working fine, I'm Playing around the local machine's because I need to apply the same rules in... (2 Replies)
Discussion started by: babinlonston
2 Replies

3. UNIX for Advanced & Expert Users

FTP While transfering files to local machine to remote machine

Hi Am using unix Ksh Am getting the problem while transferring zero size files through the script . When i transfer zero size files from local machine to remote machine manually i can able to do it . My question its beause of zero size files am not able to transfer through script ? or its... (2 Replies)
Discussion started by: Venkatesh1
2 Replies

4. Linux

rsh to other machine using script

Hi, I want to rsh to other machine & run a script, but it is nt working eg: rsh host command but after this it doesn't login into that machine & run the command on y machine but if i write rsh host then after loggi i write commands it works. Is i am doing something wrong. I jus need... (2 Replies)
Discussion started by: sarbjit
2 Replies

5. IP Networking

RSH to Ubuntu machine from Solaris machine?

This is probably really basic compared to what you guys are usually talking about here, but I have a problem and I have no idea what to do about it. I try to RSH to my Ubuntu computer from my Solaris one and run into a dead end: >> rsh 192.168.1.103 ::ffff:192.168.1.103: Connection timed out... (4 Replies)
Discussion started by: Bradj47
4 Replies

6. Red Hat

To find the LATEST file from a dir on REMOTE machine and SCP to local machine?

Hi All, URGENT - Please help me form a scipt for this: I need the LATEST file from a dir on REMOTE machine to be SCP'd to a dir on local machine. (and I need to execute this from local server) I know that the below cmd is used to find the LATEST file from a dir. But this command is not... (3 Replies)
Discussion started by: me_ub
3 Replies

7. Shell Programming and Scripting

Cut command on a remote machine using rsh

Hi all, I have a file on a remote machine and I want to do a cut operation on that file. So, I have been doing rsh <remote> " cut -d " " -f 2 <filename> " cut: invalid delimiter But, when I get the file to the local machine and run the same command, I get... (1 Reply)
Discussion started by: eamani_sun
1 Replies

8. UNIX for Dummies Questions & Answers

RSH - Remote Shell

Dear All, I was wondering if there was any way that I could make RSH be non-blocking? i.e. make a remote connection to another machine and execute a function while being able to resume your program. T (4 Replies)
Discussion started by: thoang
4 Replies

9. Shell Programming and Scripting

Rsh: test $? on remote system.

Hi, a little help. I need to test the return code of a list file command on a remote system (Unix) using the rsh command. More exactly, to test is a directory exists, I try the following command: rsh $remoteHost "ls -la " $DirRemote Now, if the $DirRemote is not correct and I test... (3 Replies)
Discussion started by: gio123bg
3 Replies

10. Shell Programming and Scripting

rsh help with remote prompts

Hi, I'm writing a shell script that rsh's onto a remote machine and runs a perl script that requires values to be entered as the script executes. I also need to ba able to see the outputs from the perl script. When I try to run it I get an stty : Invalid argument and understand that this is... (4 Replies)
Discussion started by: ianf
4 Replies
Login or Register to Ask a Question