bash format "cat" output
I'm using the --colorsel option from Xdialog and giving the output to a variable using the "cat" function.
what's happening is the Xdialog program is letting the user select a color. Then I assigned this to a file using 2>"FILE" then I'm using the cat function to read this file into a variable. Then I echo the variable and.... The output looks like this: 244 122 255 but I need it to look like this: 244, 122, 255 Is there a way to get it to read untill a space is encountered and then assign this a variable, then read untill the next space is encountered....ext...ext....? anyone know how to do this? thanks in advance!! |
You could probably pipe the output through either sed or awk to search for <space> and replace that with <comma><space>.
Use google to search for sed and awk examples. |
Thanks Alot!!!!
I ended up using awk. Here's what I had to do: Code:
DIALOG=Xdialog |
Look at THIS thread.
|
All times are GMT -5. The time now is 01:08 PM. |