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.
Asking to write as soon as possible is considered rude when people volunteer there personal time.
You have not provided enough information about the serial data. We assume that it is ASCII data of some type since you have posted you want it written to a text file. In addition, how to add a time stamp may depend on how the data is transmitted and typically bash is probably not suitable. Using a higher language would be better.
You can dump the output of a serial port to the shell. Recommend you perform a web search as to how to do that.
You can also use a shell I/O redirector to channel stdin to a file.
These concepts are pretty simple and you can find multiple suggestions for each by doing a minor amount of searching now that I've given some clues.
As far as adding a temp stamp to the data, as in to each line? You can use one of the many shell text processing tools to either pre-pend or amend data on a line-by-line basis in a text file. Those would be any of, sed, awk, tr, and perhaps there are others I've forgotten. Same comment is that you can look those things up and decide which one suits you best.
Meanwhile, what's to say that this data is text or ASCII? A lot of the data I get from things is in binary.
Perhaps you should update your fellow members a bit more about your project, as well as perform some additional work on your end to take some of these initial steps on your own.
Meanwhile, in concert with michaelk's note about being polite and patient, you should review the link in my signature that describes how to use the LinuxQuestions.org site. This gives you information about how to best pose your questions for greater effectiveness.
And please note that it's not about what we know, nor our capability to project our knowledge, but instead about how you can learn to approach this problem, solve it, and thus learn a bit about Linux along the way.
Thank you so much for the answers and the usefull advices!
I am so sorry, I wrong expressed myself, I did not want to be impolite!
More details about the problem: i use an Arduino with a sensor. I connected the Arduino with USB.
The sensor measures the temperature and the humidity and writes the data in minicom, it shows in a terminal: under one another, alternately.
I would like to those data convert a file. The temp stamp needen't to every each record. But it useful in every minute, fore example.
Thank You so much indeed!
I am thanksfull for all everything.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.