Sponsored Content
Full Discussion: awk syntax error with ssh
Top Forums Shell Programming and Scripting awk syntax error with ssh Post 302848161 by port43 on Wednesday 28th of August 2013 03:53:57 PM
Old 08-28-2013
awk syntax error with ssh

I am attempting to ssh to a server and grab the line from /etc/group if it contains a specific GID.

Example line from /etc/group:
Code:
mysql:!:64600:mysql

Run locally on <host>:
Code:
# awk -F: '$3 == 64600 {print $1}' /etc/group
mysql

Attempt to ssh to <host> and execute:
Code:
# ssh <host> awk -F: '$3 == 64600 {print $1}' /etc/group
Syntax Error The source line is 1.
The error context is
>>> == <<<
awk: 0602-500 Quitting The source line is 1.

Enclosing the command in single or double quotes gives the same error:
Code:
# ssh <host> "awk -F: '$3 == 64600 {print $1}' /etc/group"
Syntax Error The source line is 1.
The error context is
>>> == <<<
awk: 0602-500 Quitting The source line is 1.

I figure it has to have something to do with the expansion of $3 before the command is passed to <host> but I can't figure out how to protect it.

Help? Please?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

awk syntax error

can anyone see the awk syntax error near line 1? I keep getting this error and I'm not familiar with awk very well yet so it is hard for me to see the errors. fyi: deleteuser* refers to files in the directory where each one ends with a different date ls -1 /mfupload/prod02/ftp/deleteuser* |... (12 Replies)
Discussion started by: k@ssidy
12 Replies

2. UNIX for Dummies Questions & Answers

'awk' syntax error

Due to some syntax error, my below code is not working. #!/usr/bin/ksh nawk ' BEGIN { cur_val=0; cur_zero=0; cur_nine=0; sum_zero=0; sum_nine=0; } /^/ { cur_val=substr($0,5,2); if("cur_val" == "0") { ... (3 Replies)
Discussion started by: lokiman
3 Replies

3. UNIX for Dummies Questions & Answers

awk Shell Script error : "Syntax Error : `Split' unexpected

hi there i write one awk script file in shell programing the code is related to dd/mm/yy to month, day year format but i get an error please can anybody help me out in this problem ?????? i give my code here including error awk ` # date-month -- convert mm/dd/yy to month day,... (2 Replies)
Discussion started by: Herry
2 Replies

4. Shell Programming and Scripting

awk syntax error

Hi, I can't see what is wrong with the following command. I am extracting a dollar amount (AMT_REJ, 6th field) from a comma delimited record and need to output it as numeric, removing the $sign and decimal point and output to another file. Everything seems to work except the $ sign which I need... (1 Reply)
Discussion started by: ski
1 Replies

5. Shell Programming and Scripting

Syntax error using Awk

more report2.txt how to modify the AWK to print above out put for given n no of inputs using report2.txt file? out put should be (3 Replies)
Discussion started by: kanakaraju
3 Replies

6. Shell Programming and Scripting

awk syntax error

Hi All, I wrote a simple script.sh program for i in seq (22) do awk '$1==${i}' file1.txt|awk '{print $2}'> file${i}_study.txt done and then run it %bash %chmod +x script.sh % ./script.sh Give me error awk: $1==${i} awk: ^ syntax error Do you have any idea why... (3 Replies)
Discussion started by: senayasma
3 Replies

7. Cybersecurity

SSH syntax error

I have been asked to look at a problem with implementing SSH on an HP-UX server which a colleague has set up. Users connect through PuTTY. When I try to establish a connection I see the following message: Usage: -ssh host Options: -l user Log in using this user name. -n ... (6 Replies)
Discussion started by: j_wealleans
6 Replies

8. Shell Programming and Scripting

awk if else syntax error

Could somebody gently point out the error of my ways in the below (the flu I'm fighting might be contributing to my current haplessness) awk -F="\t" \ '{ for (i = 1; i <= NR; i++); FNR == i; { if (length($3) < 56 && length($1) > 56) $1=($1" "$2); $2=$3; $3=$4; ... (1 Reply)
Discussion started by: Andrew767
1 Replies

9. Shell Programming and Scripting

Syntax error in awk

I know the below code worked, but the syntax appears to be wrong and I can not seem to correct it. Thank you :). awk 'FNR==NR {E; next }>$3 in E {print $3, $5}' medical_exome__genes.txt RefSeqGene.txt > update.txt awk: cmd. line:1: FNR==NR {E; next }>$3 in E {print $3, $5} awk: cmd.... (2 Replies)
Discussion started by: cmccabe
2 Replies

10. Shell Programming and Scripting

Awk: syntax error

awk -F, ' NR>1 { BEGIN{ chr=$2 } END{ for (k in chr) {print k} } } ' $gene_file I've a really simple code. I want to store gene name and it's chromosome and in the end print them. I'm skipping line one as it contains headers. But I don't know why I get error as: (2 Replies)
Discussion started by: genome
2 Replies
SSH-KEYSIGN(8)						    BSD System Manager's Manual 					    SSH-KEYSIGN(8)

NAME
ssh-keysign -- ssh helper program for host-based authentication SYNOPSIS
ssh-keysign DESCRIPTION
ssh-keysign is used by ssh(1) to access the local host keys and generate the digital signature required during host-based authentication with SSH protocol version 2. ssh-keysign is disabled by default and can only be enabled in the global client configuration file /etc/ssh/ssh_config by setting EnableSSHKeysign to ``yes''. ssh-keysign is not intended to be invoked by the user, but from ssh(1). See ssh(1) and sshd(8) for more information about host-based authen- tication. FILES
/etc/ssh/ssh_config Controls whether ssh-keysign is enabled. /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_rsa_key These files contain the private parts of the host keys used to generate the digital signature. They should be owned by root, read- able only by root, and not accessible to others. Since they are readable only by root, ssh-keysign must be set-uid root if host- based authentication is used. /etc/ssh/ssh_host_dsa_key-cert.pub /etc/ssh/ssh_host_ecdsa_key-cert.pub /etc/ssh/ssh_host_rsa_key-cert.pub If these files exist they are assumed to contain public certificate information corresponding with the private keys above. SEE ALSO
ssh(1), ssh-keygen(1), ssh_config(5), sshd(8) HISTORY
ssh-keysign first appeared in OpenBSD 3.2. AUTHORS
Markus Friedl <markus@openbsd.org> BSD
August 31, 2010 BSD
All times are GMT -4. The time now is 06:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy