Passing awk through ssh help

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Passing awk through ssh help
# 8  
Old 09-22-2009
ksh: syntax error at line 1: `(' unexpected
# 9  
Old 09-22-2009
Originally Posted by gbarnes
I am getting syntax errors with that both:

ssh a$active "awk '{if($8 == $src && $1 == $date && $6 == $coserver )print}' /cdn/logs/FP/stale/request2028201-1253652816000.txt"

awk: {if( == && == 2009-09-22 && == 1300 )print}
awk: ^ syntax error
awk: {if( == && == 2009-09-22 && == 1300 )print}
awk: ^ syntax error
awk: {if( == && == 2009-09-22 && == 1300 )print}
awk: ^ syntax error

ssh a$active "awk '$8==s && $1==d && $6==c' s=${src} d=${date} c=${coserver} /cdn/logs/FP/stale/request2028201-1253652816000.txt"

awk: ==s && ==d && ==c
awk: ^ syntax error

I have no clue what to try.

If $8, $1, and $6 are awk variables, escape the dollar signs.

Also quote the literals.

ssh a$active "awk '{if ( \$8 == \"$src\" && \$1 == \"$date\" && \$6 == \"$coserver\" )print}' /cdn/logs/FP/stale/request2028201-1253652816000.txt"


ssh a$active "awk -v s=\"$src\" -v d=\"$date\" -v c=\"$coserver\" '{if ( \$8 == s && \$1 == d && \$6 == c )print}' /cdn/logs/FP/stale/request2028201-1253652816000.txt"

# 10  
Old 09-23-2009
Java A suggestion

Why dont you build you command seperatly and then execute it ...

CMD2SHOOT="AWK BLA BLA...." <--- this is where you include all the command
take care of double quotes and single quotes ... then ssh

ssh a$server $CMD2SHOOT

incase of doubt ... do a echo $CMD2SHOOT ... may be helpful to get more ...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Passing a variable via ssh, can't quite get it right

Hi Guys n Girls, Below im using a while command to wait for a file on another server then carrying on with the script..... I dont believe the $Sausage1 variable is being passed to the other server so its not finding the file. If i replace the variable with the date then it works as expected. ... (2 Replies)
Discussion started by: twinion
2 Replies

2. Shell Programming and Scripting

Passing special characters in an SSH connection

I have a script like this #!/bin/bash hello=$1 echo `hostname` $hello ssh gtint16 "echo $hello" if I run this as "hello''", it prints only hello on that ssh session and not the single quotes, but locally its printing hello''. I want the single quotes also to be printed... (2 Replies)
Discussion started by: Tuxidow
2 Replies

3. Shell Programming and Scripting

Passing password with SSH command

Hi Experts, I have specific requirement where I want to pass the password with the ssh username@hostname command . I dont want to use RSA public and private keys also. Because that will be on production server and no one wants to give access like that. Second thing it is production... (14 Replies)
Discussion started by: sharsour
14 Replies

4. Shell Programming and Scripting

Passing password for ssh in Script

I want to do following 2 commands via script: 1) eval `ssh-agent`2) ssh-add /export/home/sufuser/.ssh/id_rsa When asked for passphrase enter "passwordpassword1234 but whenever I run the script it stucks after "ssh-add /export/home/sufuser/.ssh/id_rsa" command and asks fro... (4 Replies)
Discussion started by: yogeshpawar
4 Replies

5. Shell Programming and Scripting

Passing Password to SSH without using expect in a Script

How can I pass password in SSH command without using expect in a shell program. I don't have expect installed on my Solaris server. #!/bin/bash ssh user@hotname (how to supply pass in script?:wall:) Experts please help its very urgent. Shrawan Kumar Sahu (4 Replies)
Discussion started by: ss135r
4 Replies

6. Shell Programming and Scripting

SSH Login by passing password.

ssh/sftp login by passing password , is it possible.Don't want to expect. (1 Reply)
Discussion started by: dinjo_jo
1 Replies

7. Shell Programming and Scripting

ssh - passing password in shell script

I have a requirement, I need to run a command at remote system using a ssh. Is there any way we can pass the username and password in shell script to the ssh command as we did it in one of the shell script for FTP. ftp -n $i <<!EOF >> user Username $PASSWD cd /home/scripts ... (5 Replies)
Discussion started by: Muktesh
5 Replies

8. Shell Programming and Scripting

Passing SSH Command Parameters

Hi, I wan to pass arguments to remote script in Unix . For that I'm using ssh PFB the code I'm using: ssh -t -l osdac "cd /appl/OSD/LOGS/flstr010/ "$1" "$2"" Problem is I'm not able to pass second argument . Can anyone plz help me in resolving this. (5 Replies)
Discussion started by: suchitasaner27
5 Replies

9. AIX

Passing a command over SSH

I'm trying to run a command over ssh to AIX 5.2, something like: ssh machine ls but it just hangs. I can ssh into the machine and run a command, but can't pass it like above. Is there a security setting that disables this by default? If so, how do I change it? Thanks! (8 Replies)
Discussion started by: hansnueski
8 Replies

10. Solaris

Passing SSH Command Parameters

On Solaris 5.9, is there any way to pass parameter(s), via SSH, to a command defined in the remote host's authorized_keys file? We have a menu that uses SSH to control some apps on our various hosts. I've been tasked with enhancing it and making it more secure. So far, the local host menu... (2 Replies)
Discussion started by: PabloCruise77
2 Replies
Login or Register to Ask a Question