Hi,
I got a line of text which has spaces in between and it is a long stream of characters. I want to extract the text from certain position. Below is the line and I want to take out 3 characters from 86 to 88 character position. In this line space is also a character. However when using cut command it excludes the spaces and I got wrong result.
...however, the data you want does not appear to be at position 86 anyway. (If the line has tabs in it, this may be a source of confusion since those would post as spaces on this board.) What do you actually want from this line?
No, they do not work. I am getting error with the code echo "${LINE:86:3}". It says "${LINE:89:3}": The specified substitution is not valid for this command.
However the awk is working and giving me wrong result. There is no tab character - all spaces.
Thanks
Asutoshch
@asutoshch
When you have a Shell problem, please state what Operating System you are running and what Shell you are using.
If you have an expected output, please tell us what you expect as the output.
Anyway based on your code, this should work in most circumstances. Always put double quotes round string variables whether it is necessary or not.