scripting

Best language to parse extremely large Excel 2007 files [closed]

梦想与她 提交于 2019-12-27 12:03:39
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . My boss has a habit of performing queries on our databases that return tens of thousands of rows and saving them into excel files. I, being the intern, constantly have to write scripts that work with the information from these files. Thus far I've tried VBScript and Powershell for my scripting needs. Both of

How to iterate over an array using indirect reference?

可紊 提交于 2019-12-27 11:05:03
问题 How can I make this code work? #!/bin/bash ARRAYNAME='FRUITS' FRUITS=( APPLE BANANA ORANGE ) for FRUIT in ${!ARRAYNAME[@]} do echo ${FRUIT} done This code: echo ${!ARRAYNAME[0]} Prints APPLE . I'm tryng to do something similar but with "[@]" to iterate over the array. Thanks in advance, 回答1: ${!ARRAYNAME[@]} means "the indices of ARRAYNAME ". As stated in the bash man page since ARRAYNAME is set, but as a string, not an array, it returns 0 . Here's a solution using eval . #!/usr/bin/env bash

Loading .sql files from within PHP

笑着哭i 提交于 2019-12-27 10:13:30
问题 I'm creating an installation script for an application that I'm developing and need to create databases dynamically from within PHP. I've got it to create the database but now I need to load in several .sql files. I had planned to open the file and mysql_query it a line at a time - until I looked at the schema files and realised they aren't just one query per line. So, how do I load an sql file from within PHP (as phpMyAdmin does with its import command)? 回答1: I'm getting the feeling that

Loading .sql files from within PHP

只谈情不闲聊 提交于 2019-12-27 10:13:07
问题 I'm creating an installation script for an application that I'm developing and need to create databases dynamically from within PHP. I've got it to create the database but now I need to load in several .sql files. I had planned to open the file and mysql_query it a line at a time - until I looked at the schema files and realised they aren't just one query per line. So, how do I load an sql file from within PHP (as phpMyAdmin does with its import command)? 回答1: I'm getting the feeling that

How can I sandbox Python in pure Python?

蓝咒 提交于 2019-12-27 10:12:40
问题 I'm developing a web game in pure Python, and want some simple scripting available to allow for more dynamic game content. Game content can be added live by privileged users. It would be nice if the scripting language could be Python. However, it can't run with access to the environment the game runs on since a malicious user could wreak havoc which would be bad. Is it possible to run sandboxed Python in pure Python? Update : In fact, since true Python support would be way overkill, a simple

How to manually expand a special variable (ex: ~ tilde) in bash

蓝咒 提交于 2019-12-27 08:49:50
问题 I have a variable in my bash script whose value is something like this: ~/a/b/c Note that it is unexpanded tilde. When I do ls -lt on this variable (call it $VAR), I get no such directory. I want to let bash interpret/expand this variable without executing it. In other words, I want bash to run eval but not run the evaluated command. Is this possible in bash? How did I manage to pass this into my script without expansion? I passed the argument in surrounding it with double quotes. Try this

bash, if then script to parse file [closed]

给你一囗甜甜゛ 提交于 2019-12-26 12:23:30
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . My requirements is to look through a F-5 config. Something like: If x=virtual grep for virtual | pool | destination File looks like this: virtual vs_website_443 { snat automap pool pl_website_443 destination 11

What tools deal with spaces in columnar data well?

瘦欲@ 提交于 2019-12-25 18:34:32
问题 Let's start with an example that I ran into recently: C:\>net user User accounts for \\SOMESYSTEM ------------------------------------------------------------------------------- ASPNET user1 AnotherUser123 Guest IUSR_SOMESYSTEM IWAM_SOMESYSTEM SUPPORT_12345678 test userrrrrrrrrrrr test_userrrrrrrrrrrr The command completed successfully. In the third row, second column there is a login with a space. This causes many of the tools that separate fields based on white space to treat this field as

How to remove double quotes using awk [duplicate]

风流意气都作罢 提交于 2019-12-25 17:45:10
问题 This question already has answers here : Split file into multiple file using awk, but in date format (2 answers) Closed 2 years ago . This is my command: awk -v DATE="$(date +"%Y%m%d")" -F"," 'NR>1 { print > "Assignment_"$1"_"DATE".csv"}' Text_01012020.CSV but it come out with this: Assignment_"A"_01012017 I want to remove "___", can you help me? I find out this: awk -v DATE="$(date +"%d%m%Y")" -F"," 'NR>1 { gsub(/"/,"",$1); print > "Assignment_"$1"_"DATE".csv"}' Text_01012020.CSV but after I

What would be the right way to declare an array within a script that will be called by cron?

自闭症网瘾萝莉.ら 提交于 2019-12-25 12:05:52
问题 I have written a KornShell (ksh) script that sets an array the following way: set -A fruits Apple Orange Banana Strawberry but when I am trying to run it from within cron, it raises the following error: Your "cron" job on myhost /myScript.sh produced the following output: myScript.sh: -A: bad option(s) I have tried many crontab syntax variants, such as: Attempt 1: 0,5,10,15,20,25,30,35,40,45,50,55 * * * * /path/to/script/myScript.sh Attempt 2: 0,5,10,15,20,25,30,35,40,45,50,55 * * * * /path