I'm looking to get a shell script to loop through a number of directories and subdirectories,looking for files that contain a particular substring, and renaming the file by replacing the search string with a different substring. For example if you had a directory full of folders that contained digital photos (along with various other files which would need to remain unaffected), and the intent was to remove the "DSC_" prefix from several thousand files buried within. I've whipped up a rather long-winded solution that works well for this purpose but chokes on directory names with spaces. I am reasonably sure there's a 2 or 3-liner that would accomplish this exact same task.
function investigate { path=$1 for file in `ls $1` #for file in *
I would like to make a one-liner, which diff's "ps aux" output before and after killing a process. So basically it should be a combination of fallowing commands: 1) diff -u 2) ps aux | awk '{print $2}' 3) kill `ps aux | grep [c]ron | awk '{print $2}'` 4) ps aux | awk '{print $2}'
How to achieve this? Something like this: Code: diff $( kill `ps aux | grep [c]ron | awk '{print $2}'` && ps aux | awk '{print $2}' ) $( ps aux | awk '{print $2}' ) I don't have pgrep or pkill available.
I am having a directory.This directory has a lot of subdirectories which contain html pages and some c source code files,Makefiles etc etc.The script I am trying to write would be executed from one directory which has all these subdirectoriesFollowing is the set of directories and files you can see
Code: ls delete.sh lddbus Makefile misc-progs sbull scullc scullp short simple
The two shell scripts (t1prog and t2prog) are given below they are working fine. The input for the first program is 't1.det' and for second program is 't1.rnaml'. These two input files are in 'dir1' folder. I am executing the shell like 'sh t1prog > t1out' and 'sh t2prog > t2out' from this directory only. Then I am executing a java program 'java RNA'; for this, t1out and t2out are input files used in the program and I am getting the final output on screen.
The input files 't1.det' and 't1.rnaml' are in different folders with same name and with different values. Each folder specifies one gene sequence input files.
In mfold directory there are 5 directors and each directory contains these input files as shown below cd mfold dir1 dir2 dir3 dir4 dir5 cd dir1 t1.det t1.rnaml
[Code].....
for inputs in different directories and executing these and redirecting the final ouput after executing 'java RNA' statement to a file is needed.
I have one directory with 3 level sub-directories, and about houndard files under those directories. I need a shell script to rename all patern mateched directories and files.
For example: the patern is AA in the directory or file name.
I have been having some fun with the shell but have become a little lost. I want to be able to email (myself and others) outputs from various commands etc. Sometimes people wish to know the contents of my music library etc and it's nice to be able to ssh in and email an ls (or similar) output.
Here is what I have been doing: Code: ls -R /home/simon/mount/sata0/audio > /tmp/musiclist mail -s $(date +%Y%m%d) email@domain.com < /tmp/musiclist The date part works perfectly and I receive an email with a subject suiting my preferential YYYYMMDD format.
But what I'd like to figure out is how to get this into a single line of code, my first attempt was: Code: mail -s $(date +%Y%m%d) email@domain.com < $(ls -R /home/simon/mount/sata0/audio) This generates an error: -bash: $(ls -R /home/simon/mount/sata0/audio): ambiguous redirect But if I simply run the code "ls -R /home/simon/mount/sata0/audio" - the output is exactly what I want.
Is what I'm trying to do even possible? I do realise that I could use something like this Code: ls -R /directory > /tmp/file && mail -s $(date +%Y%m%d) email@domain.com < /tmp/file But this is still running two commands and I'd like to figure out how to be 'cleverer'.
I have a requirement like this:Cut the characters from each line of a file with following positions: 21-24, 25-34 ,111-120.Thse fields now need to be placed in a tab delimited output file.Currently this is how I am achieving it:
I need to small shell script that I can download hdf data from ftp://e4ftl01u.ecs.nasa.gov/MOLT/MOD13A2.005/first,file name.MOD13A2.A2000049.h26v03.005.2006270052117.hdf each sub folders.next I copy all files with h26v03 to local mashine.
I am trying to create a shell script similar to ls, but which only lists directories. I have the first half working (no argument version), but trying to make it accept an argument, I am failing. My logic is sound I think, but I'm missing something on the syntax.
Code: if [ $# -eq 0 ] ; then d=`pwd` for i in * ; do if test -d $d/$i ; then echo "$i:" code....
Is there some type of functional way to read things in the Python shell interpreter similar to less or more in the bash (and other) command line shells?
Example:
Code:
>>> import subprocess >>> help(subprocess) ... [pages of stuff to read] ...
I'm hoping so as I hate scrolling and love how less works with simple keystrokes for page-up/page-down/searching etc.
I want to checksum a Slackware 13.1 64-bit DVD before installing but do not have slackware64-13.1-install-dvd.iso. What is the output of stat --format=%s slackware64-13.1-install-dvd.iso?
I've created a simple script based menu. This menu will be accessed by only a certain users via ssh.When user logs in, the menu will automatically run. (configured at user's .bash_profile).How do I force the session to close when user hits Ctrl-C or Ctrl-Break ?In a nutshell, I don't want user to have access to shell.
I have seemed to work out all bugs in pulseaudio except 1. When pulseaudio wakes up it stutters for a few seconds and then plays fine. I ran pulseaudio -vvv in the terminal and found that it was an underrun and got this message.
Code:
protocol-native.c: Requesting rewind due to end of underrun.
I'm trying to do the normal setup of sharing some dir's on my linux machine using samba, to allow a windows laptop to access them.
I've managed to get the printer shared and this is allowing to send print jobs, which come out beautifully! however the actual file shares still aren't accessible
Depending on my settings, if I have security = user then when I access from the windows machine I get a username and password box - I dont want this functionality, I want the system to access right away as it would between two windows shares.
If i change security = share then it simply lists the shares, but tells me they are all inaccessible.
I've googled and searched here, tried various different things but I just can't see why/where its asking me for the username/password combo.
I use a commercial finite element code to produce animated GIF files of my calculation results. In case you are interested, the code is COMSOL Multiphysics 4.0a, running on Fedora 13 x86_64. Note that the FEA code only has the option of saving movies as animated GIF files in Linux.
These GIF files tend to be quite large, and although they are adequate for my own use on my local computer system, I wish to convert these files into other standard formats of more manageable size. These smaller files would then be easier to distribute to others or to include in presentations and reports.
I would like to ask for recommendations for either GUI-based video player/conversion applications or command line codes that could, for example, convert from animated GIF files to MPEG files. I would prefer an application that allows for multiple input/output format choices as well as conversion options for changing the playback speed, splicing out a portion of the original animation, etc.
On startup, I get two notifications that an application is requesting access to my default keyring. the problem is that I have no idea which applications are doing this. Is there any way to see what's making the request?