Questions tagged [tail]
The tail is the part of a list that comes after the head. It's also a unix command that shows the last lines of a file.
1,004
questions
-1
votes
2
answers
47
views
Tail and search in txt file
I need to make a search on a txt file. Originally I've thought to open the file and search for the word I'm looking for on the last line
remote_file = sftp_client.open('file.txt')
try:
lst = ...
1
vote
0
answers
27
views
Can you limit the files that telegraf tail to prevent linux opened files limit?
Before nothing thanks for the help, my problem is with a telegraf that writes from csv directory to influxdb, the csv generate one row every 10 minutes from that day and the next generates another csv ...
0
votes
1
answer
59
views
xv6 C skipping blank lines
I am trying to write a program in C (for xv6) that returns the last "n" number of lines of input text or a file (essentially tail) with the exception that it should not print blank lines(&...
1
vote
1
answer
46
views
tail command not working with nodejs exec command
I'm writing a quick test script that uses the tail command to monitor output that is added to a log file. When I execute the tail command directly in the console (I'm using OpenWRT), it works fine as ...
0
votes
1
answer
67
views
What is tail -n0 -f vs tail -n1 -f [closed]
I have wrote a simple script to keep monitor log file and append line and have implement some if statement if memet.
From my understanding, tail -n0 -f and tail -n1 -f both will does the job where you ...
1
vote
1
answer
183
views
how to tail a rich progress bar outputed by a python module executed by subprocess.Popen
i have a python3 module which print a progress bar provided by rich module (./module/script.py)
import sys
from rich.console import Console
from rich.progress import Progress
import time
if __name__ ...
0
votes
1
answer
63
views
Count Lines, grep, head, and tail inside Feather Files
Setup: I am contemplating switching from writing large (~20GB) data files with csv to feather format, since I have plenty of storage space and the extra speed is more important. One thing I like about ...
0
votes
1
answer
34
views
Seek to the end of file and go up one line
Looking for some help navigating up one line in the following code.
I can't figure out a way to make it move one line up.
I have tried [1] and -1, but can't seem to move up one line.
Any help is ...
0
votes
2
answers
70
views
Is there a data structure for implementing a function equivalent to 'tail -n' command in C++?
I want to write a function equivalent to the Linux tail -n command in C++. While, I parsed over the data of that file line-by-line thereby incrementing the line count, if the file size gets really big(...
0
votes
0
answers
113
views
How to plot the last n records of a dataframe using pandas.DataFrame.tail()
I'd like to understand this odd behaviour from tail() when it is used inside a function. Here is the data:
| Date | Open | High | Low | Close | Adj Close | Volume | ...
0
votes
2
answers
76
views
Last n rows of each files in a directory
Say I have a directory with N log files inside:
file1.log
file2.log
file3.log
...
fileN.log
Which linux command can I use to print the last n rows of each of those files above?
I know how to print it ...
0
votes
1
answer
111
views
How can I monitor a CSV file in Azure blob store for newly added records, similar to unix "tail -f"
Context:
I am an information architect (not a data engineer, was once a unix/oracle developer) so my technical knowledge in Azure is limited to browsing microsoft doco :( - Please be gentle
The ...
0
votes
0
answers
17
views
Tail doesnt close when server restarts
I use ssh to tail a log. For this i have these two functions that utilize paramiko:
def do_tail(self,event=None):
with paramiko.SSHClient() as client:
self.connection=client
#client = paramiko....
0
votes
1
answer
56
views
Run tail command as background process in Python [duplicate]
I have file named test.py and I am trying to run below command as a background process as part of this script
"tail -n0 -f debug.log"
Also, I want this process to end as soon as test.py ...
0
votes
2
answers
29
views
Splicing names in a list, and adding characters to a specific string?
Hello there: I currently have a list of file names (100s) which are separated by multiple "/" at certain points. I would like to find the last "/" in each name and replace it with &...
0
votes
1
answer
171
views
In Colab : Reading / Watching logs as they grow
In Python, if you use the logging module, you can configure it to write the logs to stdout/console, a file, etc.
The problem is that you may want to monitor the logs without blocking the execution of ...
0
votes
1
answer
224
views
How to tail follow file but only output new entries to the log
I'm trying to do something similar to tail -f with go (open a file and keep tracking file changes) but only start printing the changes from the end of the file. I need to seek the end of the file but ...
1
vote
1
answer
75
views
using Tail and Grep to select a specific phrase within a double quotation
currently I am tail and grep a live log but would like to grep the entire url within the double quotation ...
Current tail i've put together
tail -F trans.log | grep --color -E -i "https://www....
1
vote
4
answers
105
views
is there efficient way for pandas to get tail rows with a condition
I want to get tail rows with a condition
For example:
I want to get all negative tail rows from a column 'A' like:
test = pd.DataFrame({'A':[-8, -9, -10, 1, 2, 3, 0, -1,-2,-3]})
I expect a '...
0
votes
0
answers
16
views
how to know if file changed or truncated in linux
I want to write a python tool which work as tail (read log content constantly)
There are two problems need to handle.
the log file might be backup and truncated
the log file might be moved and ...
0
votes
0
answers
32
views
Pythons tail log and counting for timeout
Hi I am new in python may you advice, I write code to tail log file and observer some text and count for time second until 30 and do something,
The question is when first line reach I need to count ...
1
vote
1
answer
35
views
Case doesn't work when examining tail output
I can't find the reasons why my case statement doesn't work when looking tail output.
tail -F -n1 /var/log/pihole.log |
while read input; do
echo "$input" | hexdump -C # just to ...
16
votes
5
answers
381
views
Print first few and last few lines of file through a pipe with "..." in the middle
Problem Description
This is my file
1
2
3
4
5
6
7
8
9
10
I would like to send the cat output of this file through a pipe and receive this
% cat file | some_command
1
2
...
9
10
Attempted solutions
...
-1
votes
1
answer
162
views
using tail to view the access logs on my server
I'm on centOS and new to using tail to view the access logs on my server, and I'm not able to understand the meaning of every information I see. For example, one of the info it shows me is:
123.456....
0
votes
0
answers
25
views
Collectd tail plugin always 0
I need to read the number of rows in a file (that have only IP)
The file /tmp/ip.txt is (have more than 5000 rows):
192.168.0.1
192.168.0.2
192.168.0.3
192.168.0.4
192.168.0.5
192.168.0.6
192.168.0.7
...
0
votes
1
answer
148
views
How do I add a decimal value to a value in my bash script? [duplicate]
I'm grabbing the tail of my output file and then want to add 0.000001 to that value.
So far I've tried it this way:
offset=0.000001
time=$(($(`tail -1 speed.txt1`) + $offset))
0
votes
2
answers
65
views
in shell scripting (bash), how does tail work for continuously updated file?
i have a file that is being continuously updated with.
everytime i call tail file.log it will show a different result.
My question is, how do it work under the hood ?
i would expect that it reads the ...
0
votes
0
answers
37
views
Get penultimate values from pandas group by
I want to groupby pandas dataframe and get last n elements from each group but with any offset. For example, after group by column A i've a column 'A' with elements in column 'B' with values (1,2,3,4,...
0
votes
1
answer
185
views
Reading log file and if error occurs restart service
I'm trying to create a script where it monitors a log file and if an error appears, it sends an e-mail with python. The script works, but once it detects an error, it starts spamming emails. Is there ...
-1
votes
1
answer
69
views
What is splunk's log file collect technology
I'm using Splunk and Splunk forwarder (UF) for log collecting.
I have questions that "How to Splunk collect log file?", "What is data collect technic?"
So, I tried to find answer ...
-1
votes
1
answer
174
views
How can I insert an Item at the end of the List?
I am working on a project for my Data Structures class that asks me to write a class to implement a linked list of ints.
Use an inner class for the Node.
Include the methods below.
Write a tester to ...
-1
votes
3
answers
137
views
How do I tell if a function is tail recursive C?
Is my function here a tail recursion? If so why/ why not? I have some trouble grasping the concept so any help is much appreciated.
struct link
{
int value; //data
link_t *next; //link
};
...
1
vote
1
answer
143
views
Filter followed tail to file using grep and redirect
I want to get the output of
tail -f /var/log/apache2/error.log | grep "trace1"
into a file. But
tail -f /var/log/apache2/error.log | grep "trace1" > output.txt
does not work, ...
0
votes
1
answer
289
views
Using SCP command to download logs from Linux server to local machine
How can I download last 10 lines of access log from remote server to local machine using 'SCP' command to display only. I have tried to pipe tail command with scp but couldn't download last 10 lines.
0
votes
1
answer
52
views
Azure webapp log tail fail parsing
I would like to parse my JSON log with jq, but my command didn't work anymore since few months.
I use tail from azure-cli command to show live log from my webapp
az webapp log tail --resource-group ${...
0
votes
1
answer
76
views
bash convert epoch time in tail of csv to human readable
I've spent a few hours trawling over dozens of StackOverflow questions, and they have gotten me closer to my answer, but not quite all the way.
I'm trying to combine several bash commands into one; to ...
0
votes
1
answer
255
views
How to pipe tail -f output into the shell script
I want to monitor server logs using telegram bot api with this script:
#!/bin/bash
CHATID="id"
KEY="key"
TIME="10"
URL="https://api.telegram.org/bot$KEY/sendMessage&...
0
votes
1
answer
124
views
VB.net get file Tail without reading the whole file
i'm working in a .NET Framework 4.8 Environment where i want to read the last line of a text file, similiar to a log file. As the file is continously growing i need to ocassionaly read the last line ...
0
votes
0
answers
156
views
Combining commands 'tail', 'grep' and 'echo' in command line
I'm looking to output a subset of a log over a given time period (live).
To to do this, I was trying to use tail, and then search for the string I want using grep. I'd ideally like to append a bit of ...
0
votes
2
answers
106
views
script in bash two if condition and print in for loop
Hello im learning to script in bash, i trying to solve a little exercise.
The Exercise is this
If the variable named "basenew" contains the contents of the variable
named "valuebase&...
2
votes
4
answers
107
views
Remove extra dot in a String by grep/awk/cut
I have the following text in a file, for example, output.txt
[test.tracking_utils] INFO: Tracking subtool usage: main_test
[TEST & SPEC] INFO: Uploaded file test.zip with bucket URI test/...
0
votes
0
answers
85
views
Interpreting parameters from generalized Pareto distribution
I fit a generalized Pareto distribution using the function "fitdistcens" from the package "fitdistrplus":
dist_fit_genpareto <- fitdistcens(cens_and_uncens_slice, "...
2
votes
2
answers
482
views
Is there a way to show winston log files like we show it in bunyan CLI?
In Bunyan logger we can see the log files like this:
tail -f sample.log | bunyan and show the logs colorful and show json objects pretty, but I couldn't find some thinkg like that solution in Winston ...
0
votes
0
answers
76
views
Why would the same tail command have exit code 0 from CLI and 1 when called by php exec?
I have a php script I'm using to display my php error logs on a page if I'm away from the CLI. For log files I have the main active log file (php_errors.log) which cron truncates nightly and ...
0
votes
0
answers
52
views
Pareto distribution parameter estimation with Scilab, why am I getting this enormous values?
Pareto distribution has two parameters (β,ξ), from the log likelihood maximization problem we get:
I am trying to estimate with Scilab the parameters for a simulated stock log return (2000 periods of ...
-2
votes
2
answers
372
views
Why does my tail command -n+NUM not work? [duplicate]
I want to understand the following command in Linux:
# tail -n+454 /path/to/a/file | head -n 6
I expect that tail -n+454 /path/to/a/file prints the lines, starting at line 454 and the following 5 ...
0
votes
1
answer
446
views
How to suppress the error and display only the final output of du Linux command
Running du command displays following output -
[pz@texualp ~]$ du -s /My-Data/
du: cannot read directory ‘/My-Data/ROMANIEI/smart/store’: Permission denied
du: cannot read directory ‘/My-Data/ROMANIEI/...
0
votes
1
answer
36
views
How to get line below second to last instance of a string in a file
I am trying to obtain the line below the second to last instance of a string in a file, but the tail +2 command doesn't seem to be working to find the second to last instance. When I try the code ...
0
votes
1
answer
61
views
Tail only the output of a command
I am just simply trying to run gvm-setup to configure OpenVAS. Since the installation is 100% unattended and doesn't require any user input, I am simply just trying to tail the last 2 lines to a file.
...
1
vote
2
answers
124
views
Reading ("tailing") the end of a huge (>300GB) gzipped text file
I have a text file which is >300GB in size originally, and gzipped it still has >10GB. (it is a database export which ran for days, and then was aborted, and I want to know the timestamp of the ...