LinuxQuestions.org
Review your favorite Linux distribution.
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 10-16-2018, 10:17 AM   #1
linuxadventure
LQ Newbie
 
Registered: Oct 2018
Posts: 3

Rep: Reputation: Disabled
Question Serial port output save to file


Dear Members!

Please help me!
I would like to save the serial port output in a file, for example txt file.
And i would like to add a temp stamp for the datas.

What can i writi in the command line, (Bash)?

Please write to me as possible!
Thank You so much indeed!

Your faithfully, Linuxadventure
 
Old 10-16-2018, 12:12 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,698

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Welcome to LinuxQuestions.

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.
 
Old 10-16-2018, 12:24 PM   #3
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Yes welcome to LQ linuxadventure,

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.
 
Old 10-24-2018, 12:52 PM   #4
linuxadventure
LQ Newbie
 
Registered: Oct 2018
Posts: 3

Original Poster
Rep: Reputation: Disabled
Dear Members!

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.

Sincereli, Linuxadventure
 
Old 10-24-2018, 02:30 PM   #5
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by linuxadventure View Post
The sensor measures the temperature and the humidity and writes the data in minicom
Have you looked at the options for Minicom? It captures to a log and also has timestamps for every newline.


CTRL-a
Release, then press z
That brings up the configuration dialog for minicom

L controls capture on/off

N controls timestamp on/off


They do not need to be capital letters, I just typed them as such to clarify and not have you confuse lowercase L as a number one, or letter I
 
  


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
Serial port working, but kernel console output to it disappears hda7 Linux - Kernel 5 05-09-2011 12:01 PM
Serial port output buffer lag morpheusss Linux - Software 1 03-24-2011 12:11 PM
expecting Serial port output to a buffer nathan Programming 5 09-22-2009 03:29 PM
[SOLVED] Serial port input/output error john_erlandsson Linux - Newbie 9 07-27-2009 08:47 AM
Redhat 7.1 cannot save serial port settings lukethack Linux - Newbie 0 01-10-2002 05:08 PM

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

All times are GMT -5. The time now is 07:35 PM.

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