1

String Comparison

view story
linux-howto

http://www.unix.com – Hi I am beginner in writing shell scripting please tell me how to compare a string in Unix shell. i have two variables in a shell script, Code: var1="00101 00201 00301 303 401 405" var2="101 201 301" i want to compare var1 with var2 . for example if 101 from Var1 present in Var2 or not. similarly 201 of Var1 present in Var2. If the value of Var1 & Var2 is matching i want to exclude those values and store the remaining values in Var3. My output should be Code: Var3="303 401 405" Please help to solve this problem. (HowTos)