Sponsored Content
Top Forums UNIX for Dummies Questions & Answers move files that match specific conditions Post 302720589 by rdrtx1 on Wednesday 24th of October 2012 12:09:41 PM
Old 10-24-2012
Code:
 
names=(32983_f 35416_f 43579_f) # these are the names of directories where I want to copy the files to
for i in ${names[@]}
do
  if [ -f /Users/name/Dropbox/$i_exp.txt ] ; then
    # _exp.txt is the constant part of the files I want to move
    [[ -d /Users/name/Desktop/SUBJ/$i ]] || mkdir -p /Users/name/Desktop/SUBJ/$i
    cp /Users/name/Dropbox/$i_exp.txt /Users/name/Desktop/SUBJ/$i
    # I want that this file is copied in the corresponding directory (with the same initial 5 numbers as the file)
  fi
done

Sorry, include spaces around square brackets.

Last edited by rdrtx1; 10-24-2012 at 01:16 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

grep'ing for specific directories, and using the output to move files

Hello, this is probably another really simple tasks for most of you gurus, however I am trying to make a script which takes an input, greps a specific file for that input, prints back to screen the results (which are directory names) and then be able to use the directory names to move files.... (1 Reply)
Discussion started by: JayC89
1 Replies

2. Shell Programming and Scripting

Find files that do not match specific patterns

Hi all, I have been searching online to find the answer for getting a list of files that do not match certain criteria but have been unsuccessful. I have a directory that has many jpg files. What I need to do is get a list of the files that do not match both of the following patterns (I have... (21 Replies)
Discussion started by: nikos-koutax
21 Replies

3. Shell Programming and Scripting

Recursively move directories along with files/specific files

I would like to transfer all files ending with .log from /tmp and to /tmp/archive (using find ) The directory structure looks like :- /tmp a.log b.log c.log /abcd d.log e.log When I tried the following command , it movies all the log files... (8 Replies)
Discussion started by: frintocf
8 Replies

4. Shell Programming and Scripting

How to match the below conditions?

Hello All, I have 2 files with around 2k records.. I am lost how to build a script to create another file with the below:confused::eek: Match Condition1: File1's 12th Columns data should exact match with File2's 19th Column's data Match Condition2: File1's 28th Column's data format is... (12 Replies)
Discussion started by: ailnilanjan
12 Replies

5. Shell Programming and Scripting

Bash to move specific files from folders in find file

I have a directory /home/cmccabe/nfs/exportedReports that contains multiple folders in it. The find writes the name of each folder to out.txt. A new directory is then created in a new location /home/cmccabe/Desktop/NGS/API, named with the date. What I am trying to do, unsuccessfully at the moment,... (7 Replies)
Discussion started by: cmccabe
7 Replies

6. Shell Programming and Scripting

awk to match field between two files and use conditions on match

I am trying to look for $2 of file1 (skipping the header) in $2 of file2 (skipping the header) and if they match and the value in $10 is > 30 and $11 is > 49, then print the line from file1 to a output file. If no match is foung the line is not printed. Both the input and output are tab-delimited.... (3 Replies)
Discussion started by: cmccabe
3 Replies

7. Shell Programming and Scripting

Insert a newline after match in files of specific name under some subdirectories?

Hi I'd like to add the newline: \tuser: nobody", or "<TAB>user: nobody to all files named: docker-compose.ymlin subfolders of pwd with names beginning with 10-20. Within these files, I'd like to find the line (there'll only be one) containing: command: celery workerNOTE: As far as... (2 Replies)
Discussion started by: duncanbetts
2 Replies

8. Shell Programming and Scripting

awk to print fields that match using conditions and a default value for non-matching in two files

Trying to use awk to match the contents of each line in file1 with $5 in file2. Both files are tab-delimited and there may be a space or special character in the name being matched in file2, for example in file1 the name is BRCA1 but in file2 the name is BRCA 1 or in file1 name is BCR but in file2... (6 Replies)
Discussion started by: cmccabe
6 Replies

9. Shell Programming and Scripting

Bash to move specific files to directory based on match to file

I am trying to mv each of the .vcf files in the variants folder to the folder in /home/cmccabe/f2 that the .vcf id is found in file. $2 in file will always have the id of a .vcf in the variants folder. The line in blue staring with R_2019 in file up to the -v5.6 will always be an exact match to a... (4 Replies)
Discussion started by: cmccabe
4 Replies

10. UNIX for Beginners Questions & Answers

Move several files into specific directories with a loop

Hello, I'm a first time poster looking for help in scripting a task in my daily routine. I am new in unix but i am attracted to its use as a mac user. Bear with me... I have several files (20) that I manually drag via the mouse into several named directories over a network. I've used rsync... (14 Replies)
Discussion started by: SonnyClark
14 Replies
MVPA-PREP-FMRI(1)						   User Commands						 MVPA-PREP-FMRI(1)

NAME
mvpa-prep-fmri - preprocess fMRI data for PyMVPA SYNOPSIS
mvpa-prep-fmri [OPTIONS] <fmri-data> DESCRIPTION
Tiny tool to prepare a directory for a typical analysis of fMRI data with PyMVPA. Tools from the FSL suite will be used for preprocessing. It takes a 4D fMRI timeseries as input and performs the following steps: - extract an example volume - perform motion correction using the example volume as reference - conservative skull-stripping and brain mask generation - masking of the motion-corrected timeseries with the brain mask All results will be stored either in the current directory, or in a subdirectory with the subject ID (if specified). OPTIONS
--version show program's version number and exit -v VERBOSE, --verbose=VERBOSE, --verbosity=VERBOSE Verbosity level of output -h, --help, --sos Show this help message and exit -s SUBJ, --subject-id=SUBJ Subject ID used as output path -e EXFUNC, --example-func-vol=EXFUNC Volume (numeric ID or 'last', 'first', 'middle') to be used as an example functional image. Default: 10 -m MCFLIRT_OPTS, --mcflirt-options=MCFLIRT_OPTS Options for MCFLIRT. '-plots' is auto-added -p, --mcflirt-plots Create a .pdf with plots of motion parameters -b BET_OPTS, --bet-options=BET_OPTS Options for BET. '-m' is auto-added. Default: '-f 0.3' for a safe guess of the brain outline mvpa-prep-fmri 0.4.8 April 2012 MVPA-PREP-FMRI(1)
All times are GMT -4. The time now is 05:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy