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 would like to translate a following script from linux shell to Windows XP shell
GPSID=$(awk '/GPSID/ {print $3}' gora.RTK )
awk -v variable=${GPSID} 'BEGIN {printf "Numer seryjny : " variable,$1}' >>out.txt
The second line has been translated; the problem is with defining a variable that contains shell output in windows :-(
...
Breadth-first list is important, here. Also, limiting the depth searched would be nice.
$ find . -type d
/foo
/foo/subfoo
/foo/subfoo/subsub
/foo/subfoo/subsub/subsubsub
/bar
/bar/subbar
$ find . -type d -depth
/foo/subfoo/subsub/subsubsub
/foo/subfoo/subsub
/foo/subfoo
/foo
/bar/subbar
/bar
$ < what goes here? >
/foo
/bar
/foo/subfoo...
Hi all,
I want to ask if it is possible to pass arguments to a script function by reference:
i.e. to do something that would look like this in C:
Void boo (int & myint) { myint= 5; }
main (){
int t= 4;
printf t; // t->4
boo (t);
printf t; // t ->5
}
So then in BASH I want to do somthing like:
Function boo ()
{
...
I've large number of small files with sequential filenames & i want to create a single file out of it. What is the fastest way to do this?
e.g.
1.tgz.1 1.tgz.2 1.tgz.3 =========> 1.tgz
...
At my last job (legacy FORTRAN 77 code), we had files of cross references that list what subroutines called other subroutines, in what files subroutines were defined, what common blocks held what variables, what subroutines included what common blocks, etc. These were then used by shell scripts that grepped the cross reference files and...
According to the docs for the Unix "screen" command, you can configure it in .screenrc to start with a bunch of default screens, each running a command that you specify.
Here's my cofig:
# Default screens
screen -t "shell_0" 1
screen -t "autotest" 2 cd ~/project/contactdb ; autotest
It will not run the autotest command. That window ...
Hello all,
I have this command that I run every 24 hours currently.
find /var/www/html/audio -daystart
-maxdepth 1 -mtime +1 -type f -name "*.mp3" -exec rm -f {} \;
I would like to run it every 1 hour and delete files that are older than 1 hour. Is this correct:
find /var/www/html/audio -daystart
-maxdepth 1 -mtime +0.04 -type f -...
I have two lists of equal length, with no spaces in the individual items:
list1="a b c"
list2="1 2 3"
I want to iterate over these two lists in parallel, pairing a with 1, b with 2, etc.:
a 1
b 2
c 3
I'm attempting to support modern portable Bourne shell, so Bash/ksh arrays aren't available. Shelling out to awk would be acceptable ...
I've created a custom Amazon AMI (Fedora) runs a few scripts and then shuts down.
The problem with AMI's is that if my code changes there has to be a way for the AMI instance to get the latest scripts before it executes them.
I wrote a shell script & put it in /etc/init.d/nt_startup
To keep the code up to date, I execute a "git pull...
I'm only new to using SSH, but when I log in I end up in the directory ~, which in general is the same directory when FTPing in. I can still go to /, but I don't know what the ~ means. Home? Where is it in relation to /, or how could I find out?
...
Question: How do you tell ctrl-r reverse-i-search to "reset itself" and start searching from the bottom of your history every time?
Background: When using reverse-i-search in bash, I always get stuck once it is finished searching up through the history and it cannot find any more matches. Sometimes I hit escape and re-invoke ctrl-R a se...
I need a dialog tool similar to cdialog (or whiptail), but one that will work on Windows.
I have MinGW and compiling something from source is no problem, but both cdialog and whiptail, the only ones that I know of, contain code that is UNIX-specific, and so they will not compile on Windows.
Are there any alternatives that I can use? I...
I've grown accustomed to using IPython to try things out whilst learning Python, and now I have to learn Perl for a new job.
Is there anything out there like IPython for Perl? In particular, I'm interested in completion and access to help.
...
Hello all,
I have a shell script that saves the output of a command that is executed to a CSV file. It reads the command it has to execute from a shell script which is in this format:
ffmpeg -i /home/test/videos/avi/418kb.avi /home/test/videos/done/418kb.flv
ffmpeg -i /home/test/videos/avi/1253kb.avi /home/test/videos/done/1253kb.flv
f...
Is there a command I can put into a Windows XP .bat file to bring the command shell to the front?
...
I have a CGI query like this: 'a=1&b=2&c=3'.
I want to extract it in an associative array A such as $A[a]=1, $A[b]=2 and $[c]=3.
I found this way, but I would like to find a simpler (shorter) way to this :
QUERY='a=1&b=2&c=3'
typeset -a T
T=( ${(s:&:)QUERY} )
typeset -A A
A=()
for v in $T; do
A+=( ${(s:=:)v} )
done
(bonus: find ...
I would like to resize a list of images, all in the directory. To achieve that, I use convert from imagemagick. I would like to resize
image1.jpg
image2.jpg
...
into
image1-resized.jpg
image2-resized.jpg
...
I was wondering if there is a method to achieve this in a single command line. An elegant solution could be often useful, not...
This is one of those questions where it is easier to ask someone else instead of spending thirty minutes trying to "guess" for the correct place in the documentation or search engine terms:
Press alt + numeric in bash and you get (arg [numeric]) what is that?
...
The UNIX "/usr/bin/script" command will create a running transcript of your shell session (see "man script" for more info).
However, when inside a script instance, it seems to forget the parent shell's env vars, aliases, etc.
The following example demonstrates how the "ll" alias I define is ignored inside "script":
zsh> mkdir temp
zsh...