Sponsored Content
Top Forums Shell Programming and Scripting running bash command inside awk Post 302328220 by ydk on Tuesday 23rd of June 2009 07:26:50 PM
Old 06-23-2009
able to achieve atleast,

robocopy \\192.168.1.10\d$\adir\xdir\log* some_localdir\
robocopy \\192.168.1.10\d$\adir\ydir\log* some_localdir\

awk '{printf "robocopy \\\\"$1 "\\" $2 "\\ecm\*.log some_localdir\\\n"}' ecm_app_server_list.txt | sed 's/:/$/'


now want
robocopy \\192.168.1.10\d$\adir\xdir\log* some_localdir\xdir
robocopy \\192.168.1.10\d$\adir\ydir\log* some_localdir\ydir

now I want to use following bash command to achieve this ..

awk '{printf "robocopy \\\\"$1 "\\" $2 "\\ecm\*.log some_localdir\\$(cut -d ":" -f3 $2)`\n"}' ecm_app_server_list.txt | sed 's/:/$/'

but not working .. giving error
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Running command inside awk

Hi, I have a awk script to read a CSV file. After reading the values i want to call a executable (nameely call_it) with the values what i read from the scv file. I dont want to use system command inside the awk. Is there any other way to run the executable from the awk script Thanks ... (1 Reply)
Discussion started by: Raghuram.P
1 Replies

2. Shell Programming and Scripting

How to use same variable value inside as well as outside of the awk command?

Hi Jim, The following script is in working state. But i m having one more problem with awk cmd. Could you tell me how to use any variable inside awk or how to take any variable value outside awk. My problem is i want to maintain one property file in which i am declaring variable value into that... (12 Replies)
Discussion started by: Ganesh Khandare
12 Replies

3. UNIX for Dummies Questions & Answers

using awk inside bash script?

Hello, I'm trying to write a bash script that will query the current system time (OS X 10.6.6) and then convert the output from HH:MM:SS into time in seconds. The output of the system time command (systemsetup -gettime) is returned as: Time: HH:MM:SS so I wanted to use awk -F: to grab... (5 Replies)
Discussion started by: xaiu
5 Replies

4. UNIX for Dummies Questions & Answers

Running set options from the command line and bash command

I'm reading about debugging aids in bash and have come across the set command. It says in my little book that an addition to typing set you can also use them "on the command line when running a script..." and it lists this in a small table: set -o option Command Line... (5 Replies)
Discussion started by: Straitsfan
5 Replies

5. Shell Programming and Scripting

How i can put the result of a command inside a bash variable?

#!/bin/bash #... for i in `ls -c1 /usr/share/applications` do name="cat $i | grep ^Name= | cut -d = -f2" echo $name #... done Now inside name as output is present: while i want only the result of the command. Ideally i would like obtain that information using only bash ... or... (8 Replies)
Discussion started by: alexscript
8 Replies

6. Shell Programming and Scripting

Bash- Command run from script does not pass full parameters with spaces inside

There's a JavaScript file that I call from command line (there's a framework) like so: ./RunDiag.js param1:'string one here' param2:'string two here' I have a shell script where I invoke the above command. I can run it in a script as simple as this #!/bin/bash stuff="./RunDiag.js... (4 Replies)
Discussion started by: AcerAspirant
4 Replies

7. Shell Programming and Scripting

Multiple command execution inside awk command during xml parsing

below is the output xml string from some other command and i will be parsing it using awk cat /tmp/alerts.xml <Alert id="10102" name="APP-DS-ds_ha-140018-componentFailure-S" alertDefinitionId="13982" resourceId="11427" ctime="1359453507621" fixed="false" reason="If Event/Log Level(ANY) and... (2 Replies)
Discussion started by: vivek d r
2 Replies

8. Shell Programming and Scripting

Run bash command inside zsh script

Hi, I would like to run following code in bash inside a zsh script. (In this case is output unfortunately very different if you run it in zsh). I tried to put "bash" in front of the code but I obtained following error message "bash: do: No such file or directory " eve though I merged the whole... (7 Replies)
Discussion started by: kamcamonty
7 Replies

9. Shell Programming and Scripting

Executing sed command inside a bash script

I want to run commands inside a bash script. An example is I want to pass the command in a string as regexp as an argument to the script, then run sed on the bash variable sed.sh regexp sed.sh "-i \"s/<p>//g\"" then call sed "$regexp" $fl (3 Replies)
Discussion started by: Kangol
3 Replies

10. UNIX for Advanced & Expert Users

awk trouble inside another command

I tried running this. dsh -w server1 'lsof /audit | awk '{ print $2 }'' It did not like above so I tried to escape the single parenthesis at the end. dsh -w server1 'lsof /audit | awk '{ print $2 }\'' It then hung so I changed up the parenthesis to this. This worked. dsh -w server1... (6 Replies)
Discussion started by: cokedude
6 Replies
prtdscp(1M)						  System Administration Commands					       prtdscp(1M)

NAME
prtdscp - display DSCP IP addresses SYNOPSIS
prtdscp [-v ] prtdscp [-v ] -h prtdscp [-v ] -d prtdscp [-v ] -s DESCRIPTION
prtdscp displays the IP addresses associated with a Domain to Service Processor Communications Protocol (DSCP) link. If no arguments are specified, prtdscp displays the IP addresses on both ends of the DSCP link. The IP address of either the Service Processor or domain side can be displayed separately by the use of the -s or -d options, respectively. OPTIONS
The following options are supported: -v Verbose mode. Print additional details about the program's internal progress to stderr. -h Help. Print a brief synopsis of the program's usage and exit. All other command line arguments are ignored. -d Display only the local domain's IP address. -s Display only the remote Service Processor's IP address. EXAMPLES
Example 1 Displaying both addresses The following example displays both the local domain's IP address and the remote SP's IP address: # prtdscp Domain Address: 192.168.103.2 SP Address: 192.168.103.1 Example 2 Displaying the local IP address The following example displays the local domain's IP address: # prtdscp -d 192.168.103.2 Example 3 Displaying the remote IP address The following example display the remote SP's IP address: # prtdscp -s 192.168.103.1 ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWdscpr.u, SUNWdscpu.u | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ SEE ALSO
attributes(5) SunOS 5.11 25 Apr 2006 prtdscp(1M)
All times are GMT -4. The time now is 05:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy