shell

How to copy a table from one mysql database to another mysql database

Hi, I need to copy a table from one database to another. This will be a cronjob. Which one is the best way to do it? PHP script or Shell Script. The problem with PHP, both databases has different usernames and passwords so I can't do it like this. CREATE TABLE db1.table1 SELECT * FROM db2.table1 Should I just connect first DB get all r...

convert Excel to csv either using shell script or jython . if so how

I am looking for a procedure where i can convert the excel to csv either if there some shell script , if so please guide me or if possbile how can i do in jython. The main reason is that the excel is being received from other source and the header is always changing , which is unnecessary and we need to have some automatic way to remov...

How can I write commands to the vxworks shell with a c program

If I wanted to run a shell command in linux with a c program, I would use system("ls"); Is there a way I can accomplish this in Wind River vxworks? I found the below example but I'm wondering do I need to include vxworks header files for this to work? I assume I do, but how do I figure out which one? Example: // This function runs...

Run command line arguments in python script

I have a program that is run from the command line like this python program.py 100 rfile How can I write a new script so that instead of running it with just the '100' argument, I can run it consecutively with a list of arguments like [50, 100, 150, 200]? Edit: The reason I am asking is that I want to record how 'program.py' executes...

Creating metapackage using the packagemaker command

I want to create a metapackage using the packagemaker command on the bash shell. The metapackage will consist of an installer package, localizable resources, script and some descriptors to be installed at ./Library/Application Support. I just want to know the appropriate command. ...

Conky starts above windows in Ubuntu Maverick

Hey guys, I did not run into this problem until I upgraded my Ubuntu box to Maverick Meerkat (10.10). Basically, whenever I start my computer, conky runs as expected, except it gets drawn over any windows that I load (see screenshot). To fix this for a single session, I simply restart conky by running killall conky; conky in a term...

Can I Force MATLAB to quit after user presses Control-C?

I'm running MATLAB (command line version) from a shell script, and I'd like it to preserve shell behavior where if you press Ctrl-C it exits. But instead it wants to keep control of the terminal and I (or my poor users after me) have to type quit(1) to make it quit and tell the shell it failed. You can't intercept Ctrl-C with a try/cat...

Sorting csv columns in bash, reading bash output into python variables..

Hi I have a ton of data in multiple csv files and filter out a data set using grep: user@machine:~/$ cat data.csv | grep -a "63[789]\...;" 637.05;1450.2 637.32;1448.7 637.60;1447.7 637.87;1451.5 638.14;1454.2 638.41;1448.6 638.69;1445.8 638.96;1440.0 639.23;1431.9 639.50;1428.8 639.77;1427.3 I want to figure out the data set which has...

AWK/BASH: how to match a field in one file from a field in another?

Hi all, I have 2 files, the first contains the following: ... John Allen Smith II 16 555-555-5555 10/24/2010 John Allen Smith II 3 555-555-5555 10/24/2010 John Allen Smith II 17 555-555-5555 10/24/2010 John Doe 16 555-555-5555 10/24/2010 Jane Smith 16 555-555-5555 9/16/2010 Jane Smith 00 555-555-5555 10/24/2010 ... and the second fil...

how to grep .txt .tar.gz .py file once

i can use ls|grep \.py$ to list all ends with .py file,but it's seems hard for me to grep all .py & .txt & .tar.gz file once any one could give me a hand ...

how to use ctrl-D in a shell script

Hi Everyone, I have a bash shell script that requires ctrl-D to break out of the terminal.can anyone tell me how to use it in the shell script example ssh host last --->displays the list of users who were logged on to that host i have different hosts the output is appended to one final and when i'm executing this particular shell s...

"No such file or directory" but it exists

I simply want to run an executable from the command line, ./arm-mingw32ce-g++, but then I get the error message, bash: ./arm-mingw32ce-g++: No such file or directory I'm running Ubuntu Linux 10.10. ls -l lists -rwxr-xr-x 1 root root 433308 2010-10-16 21:32 arm-mingw32ce-g++ Using sudo (sudo ./arm-mingw32ce-g++) gives sudo: unable t...

How to convert time format from "2010-10-08 00:00:01" to "1286467201" in awk

In awk, Is there a way to convert the time format from "2010-10-08 00:00:01" to 1286467201 as using the command "date" $ date +%s -d '2010-10-08 00:00:01' 1286467201 ...

starting and stopping a daemon at user login logout

I have a daemon script written in ruby which responds to commands like daemon start and daemon stop. It's executable with shebang #!/usr/bin/env ruby and it works invoked from terminal. I need to start the daemon on login and stop it on logout. Background info: KDE, zsh. I already tried to make two separate shell scripts with daemon st...

Output Redirection in C shell

I asked about pipes in a previous question, got that working perfectly. However I had some questions about output redirection like >> in a shell normally does. There doesn't seem to be a whole lot of info on the Internet about it. Here is what I have so far. Is there a better/easier way to do this, it's messy and im not even super sure t...

Python shell is restarted every time when a new module is run

I use Python 3.1 inside Windows XP and when I try to use more than one module at the same time, the Python shell restarts. What can I do? This is my module benutzer.py: class Benutzer(object): def __init__(self,benutzer): self.name = benutzer self.email = None def setzeEmail(self, adresse): self.email ...

Linux: Run a binary in a script

Hi all, i want to run a program via script. normally i type ./program in the shell and the program starts. my script looks like this: #!/bin/sh cd /home/user/path_to_the_program/ sh program it fails, i think the last line went wrong... i know this is childish question but thx a lot! ...

ubuntu/linux bash: traverse directory and subdirectories to work with files

let me start off with what I need; the program is given a directory, it will then examine all the files in the directory (works) and do stuff to the files (waiting till it can find all the files for this part). then it will look for subdirectories and re-run its self for each subdirectory. the directory I'm testing with looks like this:...

Ensuring shell script is being executed by BASH (not csh, ksh, sh etc.)

How would you exit-gracefully-upon-entry when invoking a .sh script from anything other than bash? Of course bash-isms like the following don't work in csh and the like so you get an error rather than the intended error message: if [ ${BASH_VERSION-not_running_within_bash} = not_running_within_bash ]; then ...

export env at archlinux shell

when I at company , I have to export 3 enviroment variables, http_proxy,https_proxy,all_proxy, I wrote a file ~/bin/setproxy like this #! /bin/sh export http_proxy=http://......:8888 export https_proxy=http://......:8888 export all_proxy=http://......:8888 but when I execute this file at bash, then use env | grep http_proxy , I got n...