LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Closed Thread
  Search this Thread
Old 09-25-2015, 04:07 PM   #1
karthik4455
LQ Newbie
 
Registered: Aug 2014
Posts: 9

Rep: Reputation: Disabled
Need help with ssh quiet mode


I'm trying to run a pretty lengthy command in my perl script using ssh -q function but it doesn't accept the command as it gives error:
bash: syntax error near unexpected token '('

Command I'm trying to run is:

ssh -q hostname 'stats1.pl stats:dat | grep data | grep -w 0 | awk '{system("cat /opt/jhh/etc/configuration.xml | grep "$1)}' | awk -F"=" '{print $6}' | awk '{print $1}' | sed 's/>//g' | tr -d '"''

I can give a short explanation about why I need such a lengthy command:
I will receive a output here:
stats1.pl stats:dat | grep data | grep -w 0
61574 | hostname_A | data | 1 | N/A | 0
61575 | hostname_A | data | 1 | N/A | 0

Only the items matching data and has 0 will list there.

Then I want 61574 & 61575 to be searched in a configuration file and get the output which is why I use the below:
stats1.pl stats:dat | grep data | grep -w 0 | awk '{system("cat /opt/jhh/etc/configuration.xml | grep "$1)}'
Output I will receive like:
device="61574" name="hostname_A" ip="127.0.0.1" platform="Cisco" protocol="tcp" user="admin"
device="61575" name="hostname_A" ip="10.0.0.1" platform="Cisco" protocol="tcp" user="admin"

Here I want to know the platform hence using the command stats1.pl stats:dat | grep data | grep -w 0 | awk '{system("cat /opt/jhh/etc/configuration.xml | grep "$1)}' | awk -F"=" '{print $6}' | awk '{print $1}' | sed 's/>//g' | tr -d '"'
this will give me below result:

cisco
cisco

Any help here is appreciated as I'm struck without able to execute this via script.

I'm seeing the error below. I'm afraid even if I manage to correct the below error it will prompt more and I need a solution to execute this command via Quiet mode.
[karthik4455@mastghg ~]$ ssh -q hostname 'stats1.pl stats:dat | grep data | grep -w 0 | awk '{system("cat /opt/jhh/etc/configuration.xml | grep "$1)}' | awk -F"=" '{print $6}' | awk '{print $1}' | sed 's/>//g' | tr -d '"''
bash: syntax error near unexpected token '('


Best Regards,
Karthik
 
Old 09-25-2015, 04:20 PM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Duplicate:
http://www.linuxquestions.org/questi...de-4175554523/
 
Old 09-25-2015, 07:30 PM   #3
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Moderator response

Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate of http://www.linuxquestions.org/questi...de-4175554523/
 
  


Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Brightside quiet mode Pastychomper Linux - Desktop 1 10-02-2013 08:20 AM
LSI Fusion driver take long time to load when booting in quiet mode dbrazeau Linux - Kernel 2 03-30-2010 05:11 PM
Boot cardmgr in quiet mode iXneonXi DamnSmallLinux 0 08-11-2007 10:21 PM
quiet mode for watch (redirection) Xeratul Programming 1 07-16-2006 07:39 AM
smbclient mput quiet mode? jess_wundring Linux - General 1 10-29-2002 08:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration