Looking for a solution in bash (will be part of a larger script).
Given a variable containing information of the form
diff -r efb93662e8a7 -r 53784895c0f7 diff.txt
--- diff.txt Fri Jan 23 14:48:30 2009 +0000
+++ b/diff.txt Fri Jan 23 14:49:58 2009 +0000
@@ -1,9 +0,0 @@
-diff -r 9741ec300459 myfile.c
---- myfile.c Thu Aug 21 18:22:17...
I'm just a student and I'm learning ShellScript in my college. In college lab, our ma'am just asked to enter and IP in PUTTY and launch it, open vi editor and do programming. How do I do it at home? I run XP on my computer.
I tried asking her, but God bless her, she doesn't even know the syntax of if ... else and she came to teach us.
...
In shell script, how do I iterate through each line in an ASCII file and perform an operation on its value
This is the example for an ASCII file which I have
23 3.4e-09 55.90 5.7e-07
24 12.5 79.90 7.9e-09
25 67.9 78.9 3.4e-09
26 98.8 89.67 9.7e-09
how cum it will t...
I searched google but couldn't find an answer to this rather simple question. I have a python script that has the hash-bang (#!) on the first line:
#!/usr/bin/python
However, what if this is run on a computer with python in /bin/python or /usr/local/bin/python, or some other place? There has to be a better way to set the interpreter f...
I created a program that iterates over a bunch of files and invokes for some of them:
scp <file> user@host:<remotefile>
However, in my case, there may be thousands of small files that need to transferred, and scp is opening a new ssh connection for each of them, which has quite some overhead.
I was wondering if there is no solution w...
We have a list of (let's say 50) reports that get dumped into various folders depending on certain conditions. All the reports have standard names eg. D099C.LIS, D18A0.LIS etc.
Sometimes a report can exist in up to 5 different locations, and I need to generate a list of all the locations of the most recent version of each report.
I ca...
I would like to prepend some text to multiple files in bash, I've found this post that deals with prepend: prepend to a file one liner shell?
And I can find all the files I need to process using find:
find ./ -name "somename.txt"
But how do I combine the two using a pipe?
...
In my bash script I need to change current dir to user's home directory.
if I want to change to user's foo home dir, from the command line I can do:
cd ~foo
Which works fine, however when I do the same from the script it tells me:
./bar.sh: line 4: cd: ~foo: No such file or directory
Seams like it would be such a trivial thing, b...
I want to create a extremely simple bash script, (my_copy.sh), that reads arbitrary number input files, a destination directory, and
finally asks for confirmation if you want to perform the copy.
Example usage:
./my_copy.sh
Type in the file names to copy:
file1 file2 Anna Kurt Arne
Type in the directory to copy to:
dir_3
Are...
I tried to run a shell script from java code, but I am facing problem. The script is in batchstart.sh file -
#!/bin/ksh
export DISPLAY=:0.0
Now the script is run with a dot on the command line -- . batchstart.sh
How do I run it from java? My java code is below. It throws the following exception -
java.io.IOException: .: not found
...
I have a huge file with lots of links to files of various types to download. Each line is one download command like:
wget 'URL1'
wget 'URL2'
...
and there are thousands of those.
Unfortunately some URLs look really ugly, like for example:
http://www.cepa.org.gh/archives/research-working-papers/WTO4%20(1)-charles.doc
It opens OK in a...
I have a portion of a bash script that is getting a filename without extension, but I'm trying to understand what is really going on here. What are the "%%"'s for? Can someone elaborate on what bash is doing behind the scenes? How can this technique be used on a general basis?
#!/bin/bash
for src in *.tif
do
txt=${src%%.*}
...
Hello, I am in desperate need of some advice.
I'm almost done with my junior year as a CS major. I sort of feel like a late comer because I didn't really get into computer science until sophomore year... Through hard work, lots of credit hours during the year and summer school I am almost caught up to my peers but here come the worri...
I have been using 'bash' since the time I have been using Unix- Linux/Solaris. Now, I am interested to know what do shells like 'ksh','zsh' offer better? What do 'geeks' use?
...
Is there some way to specify a directory (let's say "C:\images") and move every .jpg file from there to another directory (say "D:\media") but preserve the directory structure (so if the file were "C:\images\paintball\july\07\headshot.jpg" after moving it would be "D:\media\paintball\july\07\headshot.jpg")?
I'm using cygwin (but would b...
How would I validate that a program exists? Which would then either return an error and exit or continue with the script.
It seems like it should be easy, but it's been stumping me.
...
I want to use something like the following command to create a tarball to deploy:
tar cjvf ~/deploy.tar.bz2 `git diff --name-only 0abc 1def`
The inner git diff command produces a list of files with relative including the relative path when i run it separately.
I'm running into two problems though, I need to be able to auto escape sp...
I have a batch file like this:
java temptable %1 %2
I need the equivalent shell script for the above. I will pass the arguments to the shell script and that should be passed to temptable.
...
Hi, I tried with many different examples, but it is not working.
I would really appreciate some sample Java code to run a shell script.
...
WARNING: error instantiating 'java.util.logging.FileHandler,' referenced by handlers, class not found
java.lang.ClassNotFoundException: java.util.logging.FileHandler,
at java.lang.Class.forName(libgcj.so.7rh)
at java.util.logging.LogManager.locateClass(libgcj.so.7rh)
at java.util.logging.LogManager.createInstance(libgcj.so.7rh)
...