Thank you all ... I am a scientist learning awk so I don't mean to disregard any advice, I truly appreciate it.
Junior-Helper your code works great and is much easier to read and follow the flow. How do you do things like:
and use a collapse function for all things related to convert in line 36 or additional in line 49. I use notepad++ on a windows machine. Thank you all again .
I'm a little bit confused. You say you're learning awk, but there is no awk code in this thread.
Drawing ASCII art may be easier in vi than in notepad++, but you shouldn't have any problem even in notepad++ as long as you choose a fixed width font (e.g., courier).
Note that there is one problem with the code that junior-helper provided: None of the functions ever return! Instead of returning, each of the functions recursively calls one of the other functions. Every time the script processes another patient, panel, or bad response, it increases the size of the shell's stack. As the stack grows, the shell will slow down until (if enough patients and panels are entered before the user exits the script), it will run into a stack memory allocation limit and die. The following alternative script with a flowchart more like:
uses a couple of loops (instead of recursion) to avoid the continually growing stack issue:
This User Gave Thanks to Don Cragun For This Post:
Hi all,
I'm trying to wirte a small shell script in Linux. My script has the flow like,
cmd1
cmd2
cd testdata
cmd3
After exiting the program, the CWD remains the same as where I execute the program. I need it to be changed to the latest updated directory in the program. How can I do... (1 Reply)
hi,
Iam in directory A. I run a script from there. inside the script i have a command cd B.
When i come out of the script directory is A only.
Even when i come out scrip i want the directory to be B
How to achieve (2 Replies)
I would like to have a script that would change my current working directory. However, any time I execute a 'cd' command in a script, it holds only for the life of that script -- the working directory on exit is the same as when the script was initiated. Is it possible to have the script return... (3 Replies)
I have a directory that is existing under my root dir of the FTP server. The DIR name is 'Software Patch'. I want to move in to that DIR to download some patches. But, when I issued a command 'cd SOftware Patch', the system said that it cannot find the dir 'Software'. I tried all possible ways like... (2 Replies)
I have a directory of files and each file has a random 5 digit string at the beginning that needs to be removed. Plus, there are some files that will be identically named after the 5 digit string is removed and I want those eliminated or moved.
any ideas? (17 Replies)
I have a simple shell script that prompts the user to enter a directory to navigate to.
What i want it to do and i don't know how to do this is if the directory is invalid automatically navigate to the home directory.
echo "enter a directory to navigate to:"
read directory
cd $directory... (6 Replies)
Hi,
I Installed mysql on my CentOS 6.2 Server. But when I tried to change the location of /var/lib/mysql to another directory. I can't start the mysql. Below is what I've done
yum install mysql mysql-server mysql-devel
mkdir /path/to/new/
cp -R /var/lib/mysql /path/to/new
chown -R... (1 Reply)
I am trying to do the following task :
export ENV=aaa
export ENV_PATH=$(cd /apps | ls | grep $ENV)
However, it's not working. What's the way to change to directory and search some file in that directory in single command
Please help. (2 Replies)
Hi All,
There is a code like below in my script
###############################################
###Create Directories and Sub-Directories
###############################################
dpdir=DP_FROM_${from}_TO_${to}
mkdir $dpdir
cd $dpdir
mkdir AWQM WFCONTROLLER PROVCO PRISM
... (1 Reply)