0

I want to copy the xinput-calibrator output to the temp.txt file from my Qt application.

I am starting the QProcess from the Application

Using the command xinput_calibrator | tee log.txt, I am able to copy the complete text but I need to save only few lines of the output to the file

Below is the output of the xinput_calibrator

Warning: multiple calibratable devices found, calibrating last one (VirtualBox mouse integration)
use --device to select another one.
Calibrating EVDEV driver for "VirtualBox mouse integration" id=12
    current calibration values (from XInput): min_x=4, max_x=65512 and min_y=-52, max_y=65816

Doing dynamic recalibration:
    Setting new calibration data: 66, 65483, -125, 65584


--> Making the calibration permanent <--
  copy the snippet below into '/etc/X11/xorg.conf.d/99-calibration.conf'
Section "InputClass"
    Identifier  "calibration"
    MatchProduct    "VirtualBox mouse integration"
    Option  "Calibration"   "66 65483 -125 65584"
EndSection

Just I need copy last 5 lines to the temp.txt file

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232

1 Answers1

2

As @skwllsp mentioned your problem can be solved with xinput_calibrator | tail -n 5 | tee log.txt. However, may I ask why you're using tee to achieve this?

The tee utility copies standard input to standard output, making a copy in zero or more files. The output is unbuffered.

The purpose of tee is to write output to files and keep the pipe going to next command.

If you just want to send your output to a file you can do so with > or >>.

xinput_calibrator | tail -n 5 > log.txt

This would create log.txt if it doesn't exist, or truncate it to nothing if it already exists, and write the output to the file.

xinput_calibrator | tail -n 5 >> log.txt

This would append to the file, so that previous data isn't removed. (It will create the file if it doesn't exist.)


Further reading:

user14492
  • 853