GNUplot / sed help
Hey guys, first post :).
I'm working with GNUplot and some experimental data that I need to plot. Unfortunately, some of the data is comma separated values, and some is tab/six space separated (I thought it was tabbed but when I go into a text editor I can space six times to remove all the space so I assume that's not a tab. I don't know any more sophisticated way of determining that.) Long story short, I can set the data delimiter within GNUplot using "set datafile separator ","" or use "\t" for a tab, but I can't do that in the middle of a plot, to my knowledge. So if I'm going "plot "data.csv" using 1:2, "data.tab" using 1:2" that will error out if I set either , or \t as the separator, and if I try to use the "set datafile separator" command in the middle of "plot" that errors out too. So I want to use sed to just change the few spaced delimiter files to CSV's. "sed -i '/s/[six spaces]/,/g' data.tab" doesn't work. How can I represent spaces? Thanks for your time, Eric |
It's not working because you have a typo. It should be:
Code:
sed -i 's/[six spaces]/,/g' data.tab Forrest |
Splendid... thank you so much!
|
You can also use the "tr" (translate) command to remove extra spaces and replace the remaining space with a comma.
tr -s ' ' ',' <data.tab >data.new |
All times are GMT -5. The time now is 04:54 PM. |