I am running into a bit of a problem. I am trying to write a script that will run an interactive (fortran) program repeatedly to dump data across 36 data channels... anyway. I have gotten this far...
What I am trying to do is to copy the data files that are being dumped from the run directory into the post processor director, see the cp command. The problem I am having is that this will copy files into the directory that I dont really want. The files have a weird naming convetion, for example:
where p00, goes p00, p01, p02,..., p34, p35 for the individual data channels. So my question is:
1. How can get i to be presented as 00, 01, ...., 34, 35, so I can use that to define the files?
2. How do I extract the system time and date, so I can define the files better?
I am just wondering one thing. I always thought (and vaguely remembering using it that way) that you can cp a file into another directory with a different name, but when I try to say something like:
it basically tells me that I cant because *.dmp is not a folder. Am I fogetting something in my command?
---------- Post updated at 08:55 PM ---------- Previous update was at 09:44 AM ----------
I am sorry for the double post, but I am officially at a loss. I trying to copy my output files into another directory and then rename them, so I can feed them into my pyhton progam.
Anyway my code is as follows at the moment:
The C shell keeps throwing errors at me about cp and mv needing a directory as a target. I am getting more and more confused about this because I can do the command in the command line without any problem, but as soon as I try the same thing in the script it wont work at all
Any input is welcome...
Last edited by madtowneast; 01-30-2011 at 03:35 PM..
When you have more than 2 files on the cp/mv command line the assumption is that you want to copy/move multiple files into a directory eg:
In your case $1$2_9hst-${p}_${D}_${t}*.data is probably expanding to more than 1 file. You should also be carefull of the case were a file is not there, as something like i5r05_9hst-p07_2011-01-27_17*.data will be passed to cp as the filename and you'll get errors like:
I actually tried to avoid that problem with the loop, i.e. by passing just
every time instead of a whole set. I have modified the code a little more to just rename the files after they have been copied into a specific folder, but the mv command keeps demanding a directory as the destination instead of just being able to rename the file. I tested renaming in the command line and it works fine, so I am at a loss really. I made new script just to rename the files with the same error that the destination has to be a directory.
Hi Unix Gurus
Let's say I have the input files like the following. I need to pick the files based on my run date.
abcd_20180206.csv
abcd_20180213.csv
abcd_20180220.csv
abcd_20180227.csv
efgh_20180206.csv
efgh_20180220.csv
efgh_20180227.csv
ijkl_20180206.csv
ijkl_20180213.csv... (9 Replies)
Hi, to everybody
i have a string which Looks like this
FT47;3;1;1;;;1;09.02.2017 21:21:19;2;2
and i would like to change to value on one Position only
e.g. the values on Position 6 should change to 1 nevertheyless which values was there before
AIX 4.3.2.0 and csh
i try... (10 Replies)
Dear Friends,
Please help me on this
my script name is send.csh
In this i have written the statement like this
set args = ( city state country price )
I want to pass this array to another c shell called receiver.csh. and i want to use it in this c shell
or
how to pass to... (2 Replies)
hi,
i am writing a shell script in which i read a line in a variable.
FNAME="s1.txt s2.txt s3.txt s4.txt s5.txt"
i want to create a array and store single file names in a array..
so the array should contain
arr="s1.txt"
arr="s2.txt"
arr="s3.txt"
arr="s4.txt"
arr="s5.txt"
how to... (3 Replies)
Hi,
I'm reading a csh setup script, and came across these lines:
################################
if (! $?PROJECT_ROOT) then
setenv PROJECT_ROOT /proj/proj_123
endif
################################
Does the if endif command means, "if there is no variable named "PROJECT_ROOT",... (3 Replies)
Greetings.
I am trying to do a script that will do some file copying for me. Unfortunately I have spaces in the directory names (which I cannot change) and the result is someone hard to achieve in shell scripts. I have searched everywhere on the web but does not manage to find the answer to... (3 Replies)
Hello everybody,
I have some files in directory. I want to shift 3 characters of filenames to the right at a same time.
for example, I have filenames like $ls -l
01_2000.G3.input.txt
02_2000.G3.input.txt
...,
...,
04_2010.G3.input.txt
I want to change the filenames like... (3 Replies)
Hi,
I want to list all the files matching in a directory directory given below
Here one of the folder has a space in the path.
/MAS02/RMS/WBDev/Krishna/Krishna Mohan/FMSplitByKeyAfterChanges1000075383.fileman.*.txt.out.1000075383.0
The following works from command line... (1 Reply)
I'm always having to work in the cshell, but occasionally want to run a command using bash. is that possible? I know I could write a shell script and call bash at the begining with #!/usr/bin/bash and then my command, is there another way? (1 Reply)
Hello,
It's possible to change/put some options of the C-shell, like bold-text, date, etc?
I can't found a web site that have a explanation.
Thanks. (10 Replies)