scripting

Splitting string field and repeating other fields in output objects

╄→гoц情女王★ 提交于 2020-02-08 06:57:50
问题 I need to separate the following array data but can't think of a good and quick way to do it. Name OrderGroup OrderDate PID365583 FY13Q1-D 8/28/2014 12:00:00AM PID354731,361935 FY13Q2-D 8/28/2014 12:00:00 AM PID354737,361937 FY13Q3-D 11/7/2014 12:00:00 AM PID359099,361933,363165 FY13Q4-D 11/13/2014 12:00:00 AM Every name that has more than one number associated with it (separated by commas) I need to move to a separate line in the array and copy the same info from the array line that it's

Powershell HashSet members wrongly cast to hashset

假装没事ソ 提交于 2020-02-06 10:58:09
问题 At the end you can find my code snippet. In code that is not in the snippet $tree = OrgTree-Create($inputfile) I create a tree of nodes. The nodes are represented by the class OrgUnit. As you can see this class has a parents attr that is a HashSet of strings. The tree is correctly created, I've done some testing and all looks well. So I created a simple node --> root representation function called PrintBranchUp . Here is where I quickly ran into trouble. The behaviour that I saw as that the

Shell Script : read the output to run the next command

点点圈 提交于 2020-02-05 08:17:09
问题 I am trying to run this but still not getting the output. Don't know were I am wrong. First the script should login to the server 2nd command is " netstat -tulpun | grep -i port (port & server list is in the same file) 3rd It may get 3 to 4 output here but I need only 25 PID output not the others #!/bin/bash while read -r -u10 server port line do echo ========== server: "$server" port: "$port" ========== ssh $line "netstat -tulpunt | grep -E \"\b$port\b\"" | awk '{print $7}' | grep '/' | awk

Bash, curl, eval and whitespace

独自空忆成欢 提交于 2020-02-05 02:38:33
问题 I'm writing a script to execute CURL commands for a given user input. The script has multiple helper function to create the list of parameters (arguments) that will eventually be passed to CURL. A stripped out example, is as follows : #!/bin/bash function create_arg_list { # THIS HTTP HEADER VALUE COMES FROM THE USER and MAY CONTAIN SPACES local __hdr="x-madhurt-test:madh urt" local __params="http://google.co.in -X GET -H '$__hdr'" local __resultvar="$1" eval $__resultvar="\"$__params\"" echo

Bash, curl, eval and whitespace

。_饼干妹妹 提交于 2020-02-05 02:38:10
问题 I'm writing a script to execute CURL commands for a given user input. The script has multiple helper function to create the list of parameters (arguments) that will eventually be passed to CURL. A stripped out example, is as follows : #!/bin/bash function create_arg_list { # THIS HTTP HEADER VALUE COMES FROM THE USER and MAY CONTAIN SPACES local __hdr="x-madhurt-test:madh urt" local __params="http://google.co.in -X GET -H '$__hdr'" local __resultvar="$1" eval $__resultvar="\"$__params\"" echo

Bash Shell parameter expansion ${ }

a 夏天 提交于 2020-02-04 01:33:52
问题 I am not quite sure how to understand this- $ var=' ' $ echo "|${var}|" | | $ echo "|${var// /}|" || Vs. $ set -- '' '' '' $ echo "|${*}|" | | $ echo "|${*// /}|" | | However, when I add this after the above $ IFS= $echo "|${*// /}|" || What is going wrong in the second set of commands? Is this the expected outcome? 回答1: Example 1 $ var=' ' $ echo "|${var}|" | | $ echo "|${var// /}|" || Here you have a simple string consisting of two spaces. When you expand it between two pipe characters, you

VBScript to detect today's modified files in a folder (including subfolders inside it)

会有一股神秘感。 提交于 2020-02-02 15:30:09
问题 I need to get all the modified files inside a folder including the subfolders inside it, and copy them to another folder. How can it be done using VBScript or any other way to achieve this? Thanks in advance, Bibhu 回答1: try this (copy files modified less than 24 hrs ago ) Set objFS = CreateObject("Scripting.FileSystemObject") ''# Directory to scan strFolder = "c:\test" Set objFolder = objFS.GetFolder(strFolder) Go( objFolder) Sub Go(objDIR) If objDIR <> "\System Volume Information" Then For

Bash script to insert code from one file at a specific location in another file?

瘦欲@ 提交于 2020-02-02 15:22:51
问题 I have a fileA with a snippet of code, and I need a script to insert that snippet into fileB on the line after a specific pattern. I'm trying to make the accepted answer in this thread work, but it's not, and is not giving an error so not sure why not: sed -e '/pattern/r text2insert' filewithpattern Any suggestions? pattern (insert snippet on line after): def boot { also tried escaped pattern but no luck: def\ boot\ { def\ boot\ \{ fileA snippet: LiftRules.htmlProperties.default.set((r: Req)

Embedded script languages for PHP?

十年热恋 提交于 2020-02-01 03:14:10
问题 i was wondering if anybody knows of a nice scripting language that can be embedded into php? Javascript would be favorite and although there are several attempts they are either much too shaky/slow/outdated (phpjs, j4p5) or a real pain to get up and running on shared hosts (pecl spidermonkey). The background is: I would like to have a language that is used to control php on the server but it should also support some logic, so yaml, xml or json just isn't enough. I've looked into LUA

Embedded script languages for PHP?

て烟熏妆下的殇ゞ 提交于 2020-02-01 03:14:09
问题 i was wondering if anybody knows of a nice scripting language that can be embedded into php? Javascript would be favorite and although there are several attempts they are either much too shaky/slow/outdated (phpjs, j4p5) or a real pain to get up and running on shared hosts (pecl spidermonkey). The background is: I would like to have a language that is used to control php on the server but it should also support some logic, so yaml, xml or json just isn't enough. I've looked into LUA