String validation in shell script

Hi All,

I am a newbie...I would like to have a function which ll check if a file contains valid strings before "=" operator. Just to give you my requirement:
assume my file has content:

hello= gsdgsd sfdsg sgdsg sgdgdg
world= gggg hhhh iiiii
xxxx= pppp ppppp pppp

my requirement is to check each line of the file, get the string before "=" operator, ie in this case hello,world,xxxx. For my requirement say hello,world are valid strings. Hence i need to check if hello,world,xxxx belong to my valid string list, if not then need to return invalid from function. Please help

Bumping up posts or double posting is not permitted in these forums.

Please read the rules, which you agreed to when you registered, if you have not already done so.

You may receive an infraction for this. If so, don't worry, just try to follow the rules more carefully. The infraction will expire in the near future

Thank You.

The UNIX and Linux Forums.

1 Like