LINUX Field Separators

We have a de-supported baseline shell script that runs jobs for Appworx.  After migrating from UNIX to LINUX, it no longer works to accept multiple values for a job parameter.  Attached is the code.  I do not know shell scripting, but am attempting to learn....  I was able to get something to work with field separators at the command line but have not yet gotten changes to work with the full script.

Does anyone know all that needs to be changed to get the field separation to work on LINUX?
Melodi RobertsProgrammer/AnalystAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The script includes events that could help identify the break point.
It also includes an option Near the top of the script to enable debugging.
The print to screen could point where the issue i.e. An expected condition was not met leading to the termination of the script.
It is impossible for someone who has no access to the data to determine an issue from a script.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Melodi RobertsCommented:
I'd actually turned on the debugging to see that the piece of code that seems that it should be breaking apart a string using separator values was not working.  There is no fatal error occurring.  e.g. A parameter string might be ML~PM with '~' being the separator value.  The job being executed is only receiving the first value and not the second where more than one value is allowed and passed with the ~ separator.  I was hoping that someone could spot some code that perhaps works on UNIX but not LINUX as was the case for some of our other shell scripts that we migrated to LINUX, but it sounds like this is not the case. Thank you for your feedback.
This script seems to be called from another where some variables program, command, etc have to be set.
You have to make sure the same tools, awk, etc. are available and are within path.

You have to make sure that the same components that are available on UNIX are available/installed and since you use relative references that the commands are in the PATH

Do you have an example on what this script being called with?
Get Blueprints for Increased Customer Retention

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

Melodi RobertsCommented:
I do not have the example.  I am asking for access to more of the underlying code now, but I think I found a solution.

I played around with the line of code below because I could see it was not breaking apart the line based on the tilde/'~' character.

       var=`echo $line|awk '{{ FS = "~"}{ print $1}}'`

I changed it to what you see below  and although I need to do more testing, this appears to have done the trick.

     var=`echo $line | awk -F~ '{print$1}'`
do you have two separate accounts, you might want to check and have them consolidated into one.

In order to fix, it has to be identified what is broken or where or under what circumstance the data stream strays from the expected.
Melodi RobertsProgrammer/AnalystAuthor Commented:
I thought I already pointed that out.  The issue is with the command below.
var=`echo $line|awk '{{ FS = "~"}{ print $1}}'`

It should take a line value of 1ML~2PM and print 1ML. It prints 1ML~2PM. I used an echo command to check on it.

When I changed the command to the command below it now works.
var=`echo $line | awk -F~ '{print$1}'`

Perhaps LINUX and our full set up with it does not support the FS command or something.

I will close out this issue and check on my EE accounts.  Thanks.
Melodi RobertsProgrammer/AnalystAuthor Commented:
Thanks. Your feedback helped move me in the right direction with checking the FS command.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.