For Loop To Rename Multiple Files Finds One Non-existant File
Okay so here's something that's confusing me: I have a script that's designed to remove the words "new_" from the front of any file except two exceptions and it looks something like this...
But what's happening is that it works perfectly on any directory except one that has no files starting with "new_". In that case it will still get in the if statement and report a single occurrence. It will report that it found a file called "new_*"
This I do not understand. Can someone please explain why it is seeing a non-existent file that just happens to match the description given in the for loop? Thanks.
Last edited by Scott; 11-16-2010 at 07:25 PM..
Reason: Code tags, please...
Well the title is not too good, so I will explain.
I need to move (rename) files using a simple AIX script.
???file1.txt
???file2.txt
???file1a.txt
???file2a.txt
to be:
???renamedfile1'date'.txt
???renamedfile2'date'.txt
???renamedfile1a'date'.txt
???renamedfile2a'date'.txt
... (4 Replies)
Hi,
Is it possible to rename files at a time in a directory without using the for loop. (ex: intial filename- abc.txt to abc.tmp or abc.txt.tmp)
I need to rename the files in a remote directory to which I'm connecting thru tectia sftp. The commands 'mv', 'for', 'echo' do not work.
I have... (3 Replies)
I want to change the name of some of my files (mypics-0001, mypics-0002, mypics-0003.....mypics-0240) and I want to double check to see if this code is right:
x=0
until
do
sed 's/mypics\-*/bday/g'
done
Would this change all of my file names to "bday0001....bday0240"?
Please let me... (0 Replies)
Hi,
i need to write a shell script where i have to loop through all the file in a directory and rename them based on below condition.
file1.dat
file2.dat
file3.dat
the above files has to be moved to another directory like below
file1_201001.dat
file2_201002.dat
file3_201003.dat... (3 Replies)
Hi
I am using "ls" command to list files present on the system. "ls" lists all the files including those which are not present. Is there a way to filter the output so only the files which are actually present are shown. For exmple, the following command lists all the files:
$ ls... (2 Replies)
Hey guys, I am the definition of a newbie. I am in the process of trying to rip all my dvds onto a new HTPC I setup. While doing this, I am also trying to organize a bunch of other files I already have to proper naming conventions. So far I have just been naming each file separately (I am on a... (4 Replies)
I have files in the ABC_YYYYMMDD.zip format under a directory. Each zip file contains A text file in the ABC_YYYYMMDD.txt format.
I am trying to create a script that will Rename the zip files and their underlying text file replacing the datepart in them with .
For eg: in the case of... (1 Reply)
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)
I am trying to use sed to rename all .txt files in /home/cmccabe/test. However, I am getting an error that I seems to be putting the files in a new directory s, instead of in the original. Thank you :).
bash
# rename classified
cd /home/cmccabe/test
pattern2_old="_classify"... (2 Replies)
Discussion started by: cmccabe
2 Replies
LEARN ABOUT DEBIAN
fc
FC(1) General Commands Manual FC(1)NAME
fc - frontend script to the f2c fortran compiler
SYNOPSIS
/usr/bin/fc [-o objfile] [-c] [-S] [-C] [-u] [-w] [-w66] [-D switch] [-I includepath] [-Ntnnn] [-P] files [-l library]
DESCRIPTION
fc is a script intended to be used as a front end to the f2c FORTRAN-to-C translator. It is supposed to make the whole f2c and C compiler
setup look like a real Fortran compiler.
File arguments with a .f suffix are compiled as Fortran source. Files with a .F suffix are passed through the C preprocessor cpp(1) first.
Files with .c (C source) or .s (assembly source) suffixes are passed to the C compiler directly. Files with a .e suffix are treated as efl
source files, and files with a .r suffix are treated as RATFOR source files.
OPTIONS -o objfile
Produce an output executable named objfile rather than using the default name a.out.
-c Do not call the linker; instead, leave relocatable object files as *.o.
-S Produce assembly output as file.s
-C Compile in extra code to check that array subscripts are in bounds.
-l library
Libraries specified with this option are passed to the linker.
-U def Definitions specified with this option are passed to C compiler (for .c files) or to cpp (for .F files) to remove definition.
-u Complain about undeclared variables.
-v, --version
Print version of f2c in use
-w Omit all warning messages.
-w66 Omit Fortran 66 (Fortran IV) compatibility warning messages.
-D switch
The given switch is passed to the C compiler (for .c files), to cpp (for .F files) and to f2c.
-I includepath
Passed to the C compiler (for .c files), to cpp (for .F files) and to f2c.
-Ntnnn Allow nnn entries in table t.
-P Emit .P files.
BUGS
fc isn't really very good -- try fort77 (1), which does a better job.
This manual page isn't really very good either...
AUTHOR
S. Feldman, D. Gay, M. Maimone, N, Schryer are all mentioned in the paper on the conversion of Fortran to C.
Peter Maydell (pmaydell@chiark.greenend.org.uk) wrote this manual page, and Alan Bain (alanb@chiark.greenend.org.uk) made some minor modi-
fications.
SEE ALSO f2c(1), fort77(1), cc(1), cpp(1), ratfor(1)
May 1999 FC(1)