LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-04-2008, 04:14 PM   #1
sippyCUP
LQ Newbie
 
Registered: Aug 2008
Posts: 2

Rep: Reputation: 0
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
 
Old 08-04-2008, 04:23 PM   #2
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
It's not working because you have a typo. It should be:

Code:
sed -i 's/[six spaces]/,/g' data.tab
HTH

Forrest
 
Old 08-05-2008, 09:02 AM   #3
sippyCUP
LQ Newbie
 
Registered: Aug 2008
Posts: 2

Original Poster
Rep: Reputation: 0
Talking

Splendid... thank you so much!
 
Old 08-05-2008, 01:41 PM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
gnuplot 4.0.0 ines Linux - Software 1 04-28-2005 02:26 PM
Gnuplot allycavs Linux - Software 5 02-04-2005 07:31 AM
need help for gnuplot eph Linux - Newbie 1 08-23-2004 08:41 AM
Insert character into a line with sed? & variables in sed? jago25_98 Programming 5 03-11-2004 06:12 AM
about gnuplot Rex_chaos Linux - Software 0 09-25-2003 08:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration