I am doing some training for a job I have just got and there is an exercise I am stuck with. I am not posting to ask a question about logic, just a trivial help with string manipulation. I would appreciate if somebody could at least give me a hint on how to do it.
Basically, the intelligent part is all done.
All I have left to do is to replace the user name with the real name
user name: name.surname
real name has to be Name Surname.
However, forgot to mention, I am using - have to use - bash.
I tried all the three methods even the AWK one which we are not allowed to use, but I always get this error message:
That one will work only with zsh.
You said AWK is not allowed ..., is this a homework?
If yes, read the rules, if not, please explain where the string is coming from: an input file, a shell variable?
I mentioned it in the original post - an exercise for the training of a job i have just got. As in really, not making it up.
I can't use AWK, and, unfortunately, I can't use Java either, which is what the job is really about.
The logic of the exercise is sorted, it's just the substitution of the string I have got left.
The string comes from a list of users found in a file called passwd.
I read what you had written in the original post and i still don't understand why you cannot use AWK ... What could be the reason for such a requirement? If someone is asking you to do it in pure shell, it's quite suspicious ... (i.e. smells like a student homework, not like job requirement, at least to me ...).
it's an exercise for the training I am being given, but don't worry, I give up. Was told the command I need on another forum ( wasn't asking for the moon ) and I will post it here in case somebody needs a hand once I have the whole thing sorted.