I have an attribute that contains multiple words.
Example:
0x1230ac1="Brown Fox is Near"
I am able to get the contents of the attribute by typing a command (using a CLI interface) like this:
show attr=0x1230ac1
The output of this "show" command looks like this:
ID Name Value
0x1230ac1 User_Attribute1 Brown Fox is Near
If I use this same "show" command in a bash script I can do this:
show attr=0x1230ac1 | sed 1d | awk '{print $1,$3,$4,$5,$6}'
This is problematic because the string in the Value column might have 2 words or 20 words. I don't want to do an awk for each.
Is there a way to awk or sed or other which will pass the entire contents of 'Value' so that in my CLI script it will display all words that are contained within 'Value' ? This is important because I need to pass 'Value' to a string variable within the script.
Example:
MYSTRING=`show attr=0x1230ac1 | sed 1d | awk '{print $3-$99}' `
I know that the print $3-$99
is incorrect. It's just the example I am trying to do without having to put every possible print number.
show
command pulling the data from "somewhere", then the pipeline should be just usual text processing stuff – ilkkachu Oct 11 '19 at 20:330x1230ac1="Brown Fox is Near"
line. I'm not sure how that would be valid, and I don't even know whatshow
is. – jesse_b Oct 11 '19 at 20:36show
command actually is, (for example, the output ofshow attr=0x1230ac1 | cat -A
) rather than what it looks like. For example, if the columns are separated by tabs while the words of the value field are separated by spaces, the processing becomes trivial. – steeldriver Oct 12 '19 at 01:33