10-07-2009
rename files Ax based on strings found in files Bx
Hi,
I'm not very experienced in shell scripting and that's probably why I came across the following problem:
I do have several hundred pairs of text files (PF00x.spl and PF00x.shd) where the first file (PF00x.spl) needs to be renamed according a string that is included in the second file (PF00x.shd).
Example:
PF00x.shd contains a string (length varies from file to file; example would be: AB09098765 7 6 5) within the follwing keywords "bviwacsbviwacs" and "Adb"
The goal is to rename PF00x.spl to AB09098765 7 6 5.spl and so on for the remaining files.
I hope my description makes sense... any suggestions how I could solve that problem?
Thanks a lot!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
i have hundreds of directories that have to be renamed. the directory structure is fairly uniform which makes the scripting a little simpler.
suppose i have many directories like this */*/*/*abc* (in other words i have similar directory names 3 dirs deep that all contain the pattern abc in... (8 Replies)
Discussion started by: quantumechanix
8 Replies
2. Shell Programming and Scripting
I am trying to use a loop to strip of the funny character ^M at the end of all lines in each file found in current directory and I have used the following in a script:
find . -type f -name '*.txt' | while read file
do
echo "stripping ^M from ..."
ex - "$file" > $tempfile
%s/^M//g
wq!
# mv... (4 Replies)
Discussion started by: bisip99
4 Replies
3. UNIX for Dummies Questions & Answers
I have a number of files in directories labeled like this:
/Data/tr_gray/tr_DTI/dti_FA.nii.gz
(the brackets here represent a range of number that the files are labeled with)
I need to rename each dti_FA.nii.gz file according to the name of the folder it resides in. For example, the file ... (3 Replies)
Discussion started by: tk0034
3 Replies
4. Shell Programming and Scripting
Hi,
We have a file (e.g. a .csv file, but could be any other format), with 2 columns: the old value and the new value. We need to modify all the files within the current directory (including subdirectories), so find and replace the contents found in the first column within the file, with the... (9 Replies)
Discussion started by: Talkabout
9 Replies
5. Shell Programming and Scripting
Hi all,
I have a many folders with zipped files in them. The zipped files are txt files from different folders. The txt files have the same names. If i try to
find . -type f -name "*.zip" -exec cp -R {} /myhome/ZIP \; it fails since the ZIP files from different folders have the same names and... (2 Replies)
Discussion started by: pmkenya
2 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I have a directory with a lot of files like this:
a.bam
b.bam
c.bam
I like to rename these files based on a list where the name of the files in the first column will be replasced by the names in the second column. Here is my list which is a tab-delimited text file:
a x
b y
c ... (4 Replies)
Discussion started by: a_bahreini
4 Replies
7. Shell Programming and Scripting
Hello, I have a text file "file.list" with the contents below.
file1
filename1
file2
filename2
file3
filename3
file1, file2 and file3 are files existing in the same directory as the text file file.list.
I want to rename file1 to filename1, file2 to filename2, as show in the text... (1 Reply)
Discussion started by: james2009
1 Replies
8. Shell Programming and Scripting
Hey guys,
I have wrote the following script to apply a module named "trinity" on my files. (it takes two input files and spit a trinity.fasta as output)
#!/bin/bash -l
#SBATCH -p node
#SBATCH -A <projectID>
#SBATCH -n 16
#SBATCH -t 7-00:00:00
#SBATCH --mem=128GB
#SBATCH --mail-type=ALL... (1 Reply)
Discussion started by: @man
1 Replies
9. UNIX for Beginners Questions & Answers
Hello!
New here although not completely new to Unix.
I wonder how I could rename files based on the data found in a simple textfile.
It goes like this:
I have 4 files
1 ldfgkkfjslkdfjsldkfjsf.wav
2 nndsdflksdjf.wav
3 sdflksjdf jjsdflsdfl.wav
4 dkadsdddd.wav
Textfile.txt looks like... (14 Replies)
Discussion started by: Oortone
14 Replies
10. UNIX for Beginners Questions & Answers
Hello Everyone ,
Iam a newbie to shell programming and iam reaching out if anyone can help in this :-
I have two files
1) Insert.txt
2) partition_list.txt
insert.txt looks like this :-
insert into emp1 partition (partition_name)
(a1,
b2,
c4,
s6,
d8)
select
a1,
b2,
c4, (2 Replies)
Discussion started by: nubie2linux
2 Replies
spl(9r) spl(9r)
NAME
spl - General: Sets the processor priority to mask different levels of interrupts
SYNOPSIS
#include <machine/cpu.h>
int getspl(
void ); int splbio(
void ); int splclock(
void ); int spldevhigh(
void ); int splextreme(
void ); int splhigh(
void ); int splimp(
void ); int splnet(
void ); int splnone(
void ); int splsched(
void ); int splsoftclock(
void ); int spltty(
void ); int splvm(
void ); int splx(
int x );
ARGUMENTS
Specifies a CPU priority level. This level must be a value returned by a previous call to one of the spl routines.
DESCRIPTION
The operating system supports the naming of spl routines to indicate the associated device types. Named spl routines make it easier to
determine which routine you should use to set the priority level for a given device type. The following table summarizes the uses for the
different spl routines: Obtains the spl value. Masks all disk and tape controller interrupts. Masks all hardware clock interrupts. Masks
all device and software interrupts. Blocks against all but halt interrupts. Masks all interrupts except for realtime devices, machine
checks, and halt interrupts. Masks all LAN hardware interrupts. Masks all network software interrupts. Unmasks (enables) all interrupts.
Masks all scheduling interrupts (usually the hardware clock). Masks all software clock interrupts. Masks all tty (terminal device) inter-
rupts. Masks all virtual memory clock interrupts. Resets the CPU priority to the level specified by the argument.
NOTES
The binding of any spl routine with a specific CPU priority level is highly machine dependent. With the exceptions of the splhigh and
splnone routines, knowledge of the explicit bindings is not required to create new device drivers. You always use splhigh to mask (disable)
all interrupts and splnone to unmask (enable) all interrupts.
RETURN VALUES
Upon successful completion, each spl routine returns an integer value that represents the CPU priority level that existed before it was
changed by a call to the specified spl routine.
EXAMPLE
The following code fragment shows the use of spl routines as part of a disk strategy routine:
int s;
.
.
. s = splbio(); /* Mask (disable) all disk interrupts */
.
.
. [Code to deal with data that can be modified by the disk interrupt code]
.
.
. splx(s); /* Restore CPU priority to what it was */
spl(9r)