If I were to type a certain command, it would give me a long output in the terminal. I only need a few characters of this output. How do I, in a bash script, save only certain characters from a terminal output as a variable?
For example, if my script is:
I could save the whole output as a variable using
But I only want my IP address copied, which is after
inet [IP ADDRESS]
How would I go about doing this?
Edit: IP Address is just being used here as an example as I cannnot mention the command on here for security reasons, it's actually 'phrase: [five digit number]' in amongst other text and I just need that five digit number. Sorry for any confusion