0

I have SSH to a server and have a syslog at usr/local. I am using the command

tail -f syslog.log | grep fps

and want to save the output of it to a file.

I have tried to SCP as below

% scp [email protected]:/usr/local/syslog.log ~/Desktop/a-file.txt 

but got as

-sh: /root: Is a directory

Can anyone please help me out? additionally my ultimate aim if to read the FPS values from the file through selenium. Or is it possible to read the FPS values directly after the grep command. any suggestion would be great. Many thanks in advance.

3
  • 2
    How about ssh remoteserver tail -f /path/to/syslog.log | grep fps > localfile? I don't know selenium and can't comment on the last paragraph. Commented Aug 3, 2021 at 12:19
  • 1
    what is result of which scp or whereis scp ? Commented Aug 3, 2021 at 12:37
  • I tried "tail -f syslog.log | grep fps > output.txt" after that when I tried to execute cat output.txt then it was blank. Additionally I am doing all the above in tera term and not in CMD. Commented Aug 3, 2021 at 13:51

1 Answer 1

1

Do you need the messages on the Desktop side in real time? Because that's what the tail -f does. It follows the file.

ssh -t [email protected] "tail -f /usr/local/syslog.log | grep -i fps" >> ~/Desktop/a-file.txt

> will overwrite the content of your file every time you run that command

>> will append the content of the tail -f /usr/local/syslog.log | grep -i fps to your file instead of overwrite it

If the a-file.txt is blank then no lines containing fps were found. Also, the grep -i option greps upper and lowercase strings. See if this can help you.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.