Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Agree with above, you need to feed us enough information for us to understand what you are going to need.
If my program returned a data file like that, with no time stamp or sequence number, I would be ashamed.
GNUPLOT could be used to extract and plot data for that format, but it would be slightly ugly. There is no way to reorder the data and reliably maintain any interesting kind of relationships, so the current order must be preserved.
I am using geany as IDE. language is C. the values are of four different channels from MCP3208 which give them to pi and pi apply certain features like MAV and RMS etc to these values which are saved in .dat/.csv file. i have to plot them seperately but as they are in same column so gnuplot is taking all of them plotting a single graph which of no use... i have to chnage them into four diffrent columns. i have tried changing loops but vain....
in that it will remove the space between the columns creating one number for each line. For ex:
channels=1 Voltage=1.82
channels=2 Voltage=0.34
would become
11.82
20.34
You would need to either keep the space or replace it with a comma.
sed -e 's/^*=//g' -e 's/[ ]*=/,/g' file.dat
The above would work if my sed syntax is correct. The first rule matches the newline and removes everything. The second matches the space between columns and replaces it with a comma. You should get
`[LIST]'
`[^LIST]'
Matches any single character in LIST: for example, `[aeiou]'
matches all vowels. A list may include sequences like
`CHAR1-CHAR2', which matches any character between (inclusive)
CHAR1 and CHAR2.
A leading `^' reverses the meaning of LIST, so that it matches any
single character _not_ in LIST. To include `]' in the list, make
it the first character (after the `^' if needed), to include `-'
in the list, make it the first or last; to include `^' put it
after the first character.
so 's/[^ ]*=//g' matches the non-space characters and the '=', and replaces them with nothing, for every occurrence in the line. The space character is preserved, so no major problem.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.