Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Hi I'm currently writing a script in the bash shell (I did
echo $SHELL to make sure)and can't get it to work. First, let
me explain what I want it to do: I have a ton of files of the
format cyl1.flo_00002_9.87069E-02, where 9.87069E-02 is the
time in the simulation that this flow solution was written. I
want to take a bunch of files like this and feed them into a
postprocessor program with the following format:
<progname> cyl1 <stamp> 2, where <stamp> is just
9.87069E-02 and <progname> is just the name of the
postprocessor program The postprocessor puts out a cyl1.plt
file and another file that I don't care about for each moment
in time so I'll have about 100 .plt files when I'm done; the
problem is that every time I run <progname> it overwrites
the .plt file and I need a .plt file for each moment in time
that I have .flo files for so I want to convert the cyl1.plt
file directly after it's written at each moment in time to
cyl1_n.plt where n is the iteration number. I want the
numbering scheme to start at the first data point in time and
go in order from there (i.e. the .plt file from the
postprocessor where cyl1.flo_00001_0.00000E-00 was the input
should be changed to cyl1_1.plt from cyl1.plt and so on.) I
ran into a problem in that when I do ls in my directory where
all the .flo files that it lists the .flo files in order of
the first number of the timestamp, i.e. 2.333E-03 is ahead of
2.567E-01 and so on so I wrote my script to do all the 10E-04
terms, then 10E-03, etc. etc. When I run the script with
source rename I get the error bash: ELF: command not found.
I attached my script to this email so you could have a look at
it and maybe help me out a little. Any help you can give me
would be greatly appreciated; the guys I work for are
out of town this week so I don't really have anyone to help me
out and I'm still relatively new to Linux outside of simple operations like moving files, deleting files, running programs, etc. I pasted in my script code below in order to try to make things easier.
#Declare k, the last digit of the lowest exponent and store that value in k
declare -i k
echo "Please enter last digit of lowest exponent"
#Declare n, the number of the iteration where the first solution in time is #given n=1 and then numbered in order
for k in 4 3 2 1 0
for file in ~/dir1/dir2/dir3/dir4/cyl1.flo_?????_?.?????E-0$k
#read in each .flo file passing only its time stamp on the end as a #parameter
<progname> cyl1 $(file:15:11) 2
#increase n by 1 in order to make the files the correct number
I changed that and I'm still getting the same error. I emailed my system administrator but it's Memorial Day here in the States so no one is working. I think I may need to add something to my PATH because I did a search on everything2.com and it says that the usual reason for the error is something not being in your path. I attempted adding various things in my PATH (I made sure to NOT delete anything out of my PATH) but nothing has worked yet. You have any other possible ideas?
Fiddled about a little more, I think it's because of the name you have given the script - their is probably a /usr/bin/rename on your system, 'cos source is searching your path it's getting itself messed up when you do source rename
changed the name of the script from rename to something unique bugsbunny or something and see what happens
It works now; I gave it an arbitrary name and is outputting just as I intended. Thanks a lot for your help; now I won't have to make up a bunch of bs next week when the guys I work for at my research job wonder why the hell I didn't get anything done in the week and a half they were gone!!!