Sponsored Content
Top Forums Shell Programming and Scripting loop through numbered filenames Post 302313251 by polly_falconer on Tuesday 5th of May 2009 06:27:58 AM
Old 05-05-2009
Ok - I've put some 'echo's in so I could diagnose the problem


Code:
1
chrom.mlinfo
chrom.mlprob
./assoc.sh: line 27:  4075 Segmentation fault      mach2qtl -d PC_full.dat -p PC_full.ped -i $infofile --probfile $probfile >PC_full_$i.txt
2
chrom.mlinfo
chrom.mlprob
./assoc.sh: line 27:  4076 Segmentation fault      mach2qtl -d PC_full.dat -p PC_full.ped -i $infofile --probfile $probfile >PC_full_$i.txt
3
chrom.mlinfo
chrom.mlprob
./assoc.sh: line 27:  4077 Segmentation fault      mach2qtl -d PC_full.dat -p PC_full.ped -i $infofile --probfile $probfile >PC_full_$i.txt
4
chrom.mlinfo
chrom.mlprob
./assoc.sh: line 27:  4078 Segmentation fault      mach2qtl -d PC_full.dat -p PC_full.ped -i $infofile --probfile $probfile >PC_full_$i.txt
5
chrom.mlinfo
chrom.mlprob
./assoc.sh: line 27:  4079 Segmentation fault      mach2qtl -d PC_full.dat -p PC_full.ped -i $infofile --probfile $probfile >PC_full_$i.txt
6
chrom.mlinfo
chrom.mlprob
./assoc.sh: line 27:  4080 Segmentation fault      mach2qtl -d PC_full.dat -p PC_full.ped -i $infofile --probfile $probfile >PC_full_$i.txt
7
chrom.mlinfo
chrom.mlprob
./assoc.sh: line 27:  4081 Segmentation fault      mach2qtl -d PC_full.dat -p PC_full.ped -i $infofile --probfile $probfile >PC_full_$i.txt
8
chrom.mlinfo
chrom.mlprob
./assoc.sh: line 27:  4082 Segmentation fault      mach2qtl -d PC_full.dat -p PC_full.ped -i $infofile --probfile $probfile >PC_full_$i.txt
9
chrom.mlinfo
chrom.mlprob
./assoc.sh: line 27:  4083 Segmentation fault      mach2qtl -d PC_full.dat -p PC_full.ped -i $infofile --probfile $probfile >PC_full_$i.txt
10
chrom.mlinfo
chrom.mlprob
./assoc.sh: line 27:  4084 Segmentation fault      mach2qtl -d PC_full.dat -p PC_full.ped -i $infofile --probfile $probfile >PC_full_$i.txt
11
chrom.mlinfo
chrom.mlprob
./assoc.sh: line 27:  4087 Segmentation fault      mach2qtl -d PC_full.dat -p PC_full.ped -i $infofile --probfile $probfile >PC_full_$i.txt
12
chrom.mlinfo
chrom.mlprob
./assoc.sh: line 27:  4088 Segmentation fault      mach2qtl -d PC_full.dat -p PC_full.ped -i $infofile --probfile $probfile >PC_full_$i.txt
13
chrom.mlinfo
chrom.mlprob
./assoc.sh: line 27:  4089 Segmentation fault      mach2qtl -d PC_full.dat -p PC_full.ped -i $infofile --probfile $probfile >PC_full_$i.txt
14
chrom.mlinfo
chrom.mlprob
./assoc.sh: line 27:  4090 Segmentation fault      mach2qtl -d PC_full.dat -p PC_full.ped -i $infofile --probfile $probfile >PC_full_$i.txt
15
chrom.mlinfo
chrom.mlprob
./assoc.sh: line 27:  4091 Segmentation fault      mach2qtl -d PC_full.dat -p PC_full.ped -i $infofile --probfile $probfile >PC_full_$i.txt
16
chrom.mlinfo
chrom.mlprob
./assoc.sh: line 27:  4092 Segmentation fault      mach2qtl -d PC_full.dat -p PC_full.ped -i $infofile --probfile $probfile >PC_full_$i.txt
17
chrom.mlinfo
chrom.mlprob
./assoc.sh: line 27:  4093 Segmentation fault      mach2qtl -d PC_full.dat -p PC_full.ped -i $infofile --probfile $probfile >PC_full_$i.txt
18
chrom.mlinfo
chrom.mlprob
./assoc.sh: line 27:  4094 Segmentation fault      mach2qtl -d PC_full.dat -p PC_full.ped -i $infofile --probfile $probfile >PC_full_$i.txt
19
chrom.mlinfo
chrom.mlprob
./assoc.sh: line 27:  4095 Segmentation fault      mach2qtl -d PC_full.dat -p PC_full.ped -i $infofile --probfile $probfile >PC_full_$i.txt
20
chrom.mlinfo
chrom.mlprob
./assoc.sh: line 27:  4096 Segmentation fault      mach2qtl -d PC_full.dat -p PC_full.ped -i $infofile --probfile $probfile >PC_full_$i.txt
21
chrom.mlinfo
chrom.mlprob
./assoc.sh: line 27:  4097 Segmentation fault      mach2qtl -d PC_full.dat -p PC_full.ped -i $infofile --probfile $probfile >PC_full_$i.txt
22
chrom.mlinfo
chrom.mlprob
./assoc.sh: line 27:  4098 Segmentation fault      mach2qtl -d PC_full.dat -p PC_full.ped -i $infofile --probfile $probfile >PC_full_$i.txt

so my incremental numbering is working put the value of 'i' is not being used in the filenames.

Code:
1
chrom.mlinfo
chrom.mlprob

should be:

Code:
1
chrom1.mlinfo
chrom1.mlprob

what am I doing wrong?

I've tried with and without double quotes (") around filenames.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

changing filenames in a directory to a number within a loop

hey guys. i'm new to shell scripting but not new to programming. i want to write a script that will take all the files in the current directory that end with a particular filetype and change all their names to a number in order. so, it would take all the jpg files and sort them in alphabetical... (30 Replies)
Discussion started by: visitorQ
30 Replies

2. UNIX for Dummies Questions & Answers

extracting and using date from filenames in a loop

HIya, Having a dumb day whilst writing an archive process in Shell want to extract from the filename the date and archive into tar files based on this, I don't want to use mtime as it may not be the actual file date. The files are -rw-rw---- 1 user admin 100 Aug 29 11:10... (2 Replies)
Discussion started by: badg3r
2 Replies

3. Shell Programming and Scripting

Whitespace in filenames in for loop in bash script

I'm trying to search all .odt files in a directory for a string in the text of the file. I've found a bash script that works, except that it can't handle whitespace in the filenames. #!/bin/bash if ; then echo "Usage: searchodt searchterm" exit 1 fi for file in $(ls *.odt); do ... (4 Replies)
Discussion started by: triplemaya
4 Replies

4. Shell Programming and Scripting

Listing even numbered files

Hi All, Could you please help in this case? Case: there's a directory 'CKMDB' in this directory, there are 30 files named in this manner 1.txt 2.txt 3.txt .... 30.txt Could you please guide me how to list only even numbered files like 2.txt... (5 Replies)
Discussion started by: xsam
5 Replies

5. Shell Programming and Scripting

For loop with dashes in filenames causing weird output

Hi again, What i'm trying to accomplish here is search a large directory for certain filesames, read from a txt file and looping through it. For instance, one of my target names from the loop file is: 1ad55f47-c342-496b-a46d-ba7de0f1b434 My loop is constructed thusly, run in a directory... (2 Replies)
Discussion started by: Karunamon
2 Replies

6. Shell Programming and Scripting

rename numbered files to numbered files with leading zeroes

Hi, I have some hundreds/thousands of files named logX.dat, where X can be any integer, and they are sequential, X ranges between 1 and any number: log1.dat log2.dat log3.dat log6.dat log10.dat ... log6000.dat I would like to rename them to scatter_params_0001.dat... (6 Replies)
Discussion started by: pau
6 Replies

7. Shell Programming and Scripting

renaming numbered files

Hi there, I've got a set of files that are named as follows: image_N1_8letters.jpg image_N2_8letters.jpg ... image_N10_8letters.jpg image_N11_8letters.jpg .... image_N100_8letters.jpg image_N101_8letters.jpg with the "8letters" bit always consisting of 8 but always different... (3 Replies)
Discussion started by: kjartan
3 Replies

8. Shell Programming and Scripting

Generate filenames in a loop

Hi all, I want to generate output files in a loop, run the same command on the same input file 1000 times and output in files with a new name each time, maybe a number appended to it. The output will be different each time as I`m sampling randomly from the input file. I want to do the... (3 Replies)
Discussion started by: newbie83
3 Replies

9. Shell Programming and Scripting

For/While Loop to Increment Filenames in a Script

Daily stupid question. I want to increment the file name everytime the script is run. So for example if the filename is manager.log and I run the script, I want the next sequence to be manager.log1. So to be clear I only want it to increment when the script is executed. So ./script... (10 Replies)
Discussion started by: metallica1973
10 Replies
All times are GMT -4. The time now is 04:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy