I want to automate some work in a shell script. Between the codes I need to make a comparison between the two names that share the same points but differ in a letter. I have a bunch of strings:
YC1SM YM1SM YC1SN I need to match the following: $ a = YC1SM $ b = YM1SM
I need this if the use of regular expression is basically To do something like this:
If [$ a match $ B]; Edit: The names are all the same length. They are all different in just one letter. This different letter is in the same place in the strings (here, the second letter).
Edit2: Added more scenario
Variable a
Create a pattern and match the b
against the pattern.
a = YC1SM B = YM1SM pattern = "$ {a: 0: 1}? $ {A: 2}" resonance "$ pattern" [[$ b == $ pattern]] & Amp; Amp; Echo mail
y1sm match
if not matching, then ?
should change [[: alpha:]]
Comments
Post a Comment