0

Geany is my main text editor.

I am looking for a way to open a text file where it shows the last few lines of the file AND be able to edit such file.

That would be good for looking at the end of long log files.

Preferably with Geany.

  • 2
    I am curious as to why you don't just use tail? or are you going to be editing the end of the log files as well? – j-money Aug 16 '18 at 3:21
  • Or ctrl+end to move to the end of the document in Geany. – DK Bose Aug 16 '18 at 3:27
  • @DK Bose I want to already be at the end when file is opened. – fixit7 Aug 16 '18 at 3:31
  • @ j-money Yes, to also edit said file. – fixit7 Aug 16 '18 at 3:36
  • you might try inspecting the tail, and then using sed to edit the file. I'm not sure what edits you're trying to make but I know on my machine I have a cvs file that has ~340,000,000 lines in it and it woudl take up to 10 minutes to open up vim with the cursor at the end, whereas tail and sed was generally faster! Granted it was only mariginally faster but hey improvements are improvements :) – j-money Aug 16 '18 at 4:27
2

The --line (abbreviated -l) command-line option specifies which line number to go to after opening the file.

Presumably, specifying a very high number like 1 billion (1000000000) should ensure it goes to the last line each time.

0

Since comments are so difficult to edit, I did this.

#!/bin/bash
# Ubuntu_Mate 18.04 LTS
#
#  Look at end of text file using Geany.  tail not needed. 
#
# MUCH HELP from thomasrutter at https://askubuntu.com/
#
#
# syslog is in /var/log

cd /home/andy/Downloads
# Send syslog to text file
cat /var/log/syslog > syslog.txt
# using geany, open syslog at the end
geany -l 10000000 syslog.txt

"It is always too soon to quit."

  • I don't understand what the cd and cat have to do with the question. And anyway why use cat instead of cp? – wjandrea Aug 16 '18 at 5:01
  • @wjandrea Is there an advantage in using cp instead of cat? There are several ways of frying chicken. – fixit7 Aug 16 '18 at 5:07
  • Actually, never mind. On looking it up, it appears it's only a problem for copying binary files. Text files are fine. – wjandrea Aug 16 '18 at 5:12
  • @wjandrea No problem. – fixit7 Aug 16 '18 at 6:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.