Transpose a column to a custom row
Hei,
I have a grep result like this: AR AT BG BO BR CL CN how can i get this to a variable: AR, AT, BG, BO, BR, CL, CN |
Quote:
Code:
var=$(grep whatever) |
With
Code:
var=$(grep whatever) |
For comma separated values, I would add:
Code:
var=$(grep whatever | paste -sd,) |
Quote:
|
The command is:
Code:
grep pattern file.txt | cut -d " " -f2 Code:
AR |
It works for me:
Code:
$ cat file.txt |
I restarted the machine and it seems to be working now. Don't know what i got wrong. Thnx anyway.
|
All times are GMT -5. The time now is 04:20 AM. |