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.

0
votes
3answers
36 views

Combining large number of files in one file using terminal

I have 600 files that I want to combine/merge into one. I've done that using the following command on Mac terminal: cat neutral_*.msOut.gz > neutral.msOut Each file has the following format: /...
1
vote
1answer
33 views

Ansible - How to loop through command with items until registered variables are equal?

I'm trying to find if a file has had any writes in the last 15 seconds. - name: 'Check File for Writes' shell: tail -n 50 /path/to/some/file | sha1sum loop: - 1 - 2 register: ...
0
votes
0answers
18 views

Fluentd tail file is not working with log rotation

I am trying to tail nifi-app.log which is rotated by apache nifi in every one hour. The tail file with fluentd works fine initially, but once nifi rotates the file, the tail file stops working. I ...
0
votes
1answer
8 views

Nodejs not able to concurrently access a file from two apps

I have two nodejs apps. One is writing logs to a file using rotating-file-stream. The second app needs to consume these logs and process by reading the log file as it is changing. Basically I am ...
0
votes
1answer
40 views

Is “docker logs container-id | tail -10” a valid command?

I'm running the command docker logs <container-id> | tail -10 and still, docker shows the entire log history. I know docker logs --tail 10 <container-id> is a valid command and serves the ...
0
votes
3answers
40 views

grep tail and head wrong result

I want to show the 3 first lines and the 2 last lines that contain a word. I tried a grep command but it's not showing what I want. grep -w it /usr/include/stdio.h | head -3 | tail -2 It only ...
-2
votes
2answers
43 views

How to get last 5 rows per column value on Pandas (5 actions before abandonment)

Relatively new to Py and this forum, thanks in advance for the help. I am trying to get the last 5 actions customers did before leaving a page on the website. if i have a data sample like this: ...
0
votes
0answers
83 views

Recursive symmetric difference between two linked list

i'd like to share a problem i'm struggling with. I need to create two recursive function (with tail recursion, i'm not allowed to put multiple returns inside the body of the function) and the ...
1
vote
2answers
38 views

Testing “tail -c 1” in bash

In Linux - check if there is an empty line at the end of a file, some posts make use of [[ ]] and == to compare characters. I would like to write a one-line command for detecting if there's no ...
0
votes
1answer
34 views

How to do log tailing in realtime efficiently and in an unblocking manner in tornado python

I have a little webapp in a tornado based python project and i need to implement realtime log tailing (one of the few things i am stuck at). The behaviour shoudl be similar to unix's tail -f. It woudl ...
0
votes
1answer
91 views

Tail recursive maximum depth method of binary tree in Scala

I wrote a method to calculate the maximum depth of a binary tree. I would like to write a tail recursive method. I thought of using lists, but I didn't find solutions This is my method that is not ...
0
votes
3answers
94 views

While tail grep for string and if true, issue iptables command for the ip?

Trying to tail a log file (iptraf log) and grep a string to automatically ban people who hit a telnet port. The log is forever rolling (Meaning it's constantly being written to) and i need to read ...
3
votes
4answers
92 views

Use grep command but only for the last lines of a file?

How can I perform a grep on only the 'tail' of a file? I am trying to run this command: grep 'TEST COMPLETE' -L *.log TEST COMPLETE appears in the last couple lines, this command lists all the ...
1
vote
1answer
41 views

tail multiple files and input search term from file, output items searched with filenames

This currently works ok, want to add the following capabilities: pipe search items from mygrepitemslist.txt (line by line) instead of my explicitly stating error1 and error2 (bonus if spaces can be ...
1
vote
0answers
22 views

How do I create a data frame after using groupby.tail

I want to create a plot on terrorist groups within my data, I have grouped and used.tail however I cannot plot the data -<bound method Series.count of terrorist_group -Revolutionary Armed Forces ...
1
vote
3answers
85 views

Utilising variables in tail command

I am trying to export characters from a reference file in which their byte position is known. To do this, I have a long list of numbers stored as a variable which have been used as the input to a tail ...
0
votes
0answers
99 views

Flume: tailing and greping not working as expected

Flume hackers! This is what I'm trying to accomplish: Two files A,B, both can contain lines with "hello" or without "hello". Lines from both files with "hello" shall end up in a local file X, and ...
-2
votes
2answers
44 views

Replacing row elements in a dataframe based on values from another dataframe [duplicate]

I'm fairly new to R so I hope somebody can help me. An output table in one of my scripts is the averagetable below showing different proportions of the event Standing in three different clusters: >...
0
votes
1answer
28 views

Typescript `custom type` only works in type world, but not actually working with `function`

I have a custom type called Tail, it will return array type without first element: type Tail<T extends any[]> = ((...t: T) => any) extends ((_: any, ...tail: infer TT) => any) ? ...
1
vote
0answers
49 views

nohup script stopped after some time

I have a monitoring script running on my server which looks like #!/bin/sh tail -F /data/logs.txt | grep -E --line-buffered -io 'keyword1|keyword2' | while read -r line ; do case "$...
1
vote
1answer
45 views

Why can't I tail a log in powershell when I run it from the run Window?

If I open a Power Shell window and run the following command it works fine... get-content -Path C:\Users\user\AppData\Local\Temp\90\tmpDF49.tmp -wait But if I open the run menu (WINKEY+R) and then ...
0
votes
1answer
25 views

how to create subset of large file with echo tail [duplicate]

I want to open a large error log file (with millions of lines). To investigate, I just need to look at the recent log. So I would like to copy the "tail" result of the large file to a new file. How ...
1
vote
0answers
25 views

Why piping Python logger output to tail or lnav messes the output line endings?

I have a long-running python program which produces a lot of logs. I want to format the logs using an external tool (lnav, multitail, ...), mainly to get colored logs without changing my code (for ...
2
votes
1answer
37 views

Why is `tail -n 1` returning two lines on this file when I would expect 1

The file in this gist has two long lines. When I run tail -n 1 on it, both lines are returned (I would expect just the last one). When I run head -n 1 on it, only the first line is returned (as ...
0
votes
1answer
58 views

Linux (ubuntu) - sed, removing only pattern match in file

I want to read the screen log file for one the games I am hosting on a Linux (ubuntu) machine. I read it through a web interface and I only display 20 lines at a time as it would get too big for my ...
-3
votes
1answer
48 views

How to print lines between 2 values using tail & head and pipe?

For example:how can I print specific lines of a .txt file between line 5 and line 8 using only tail and head
0
votes
1answer
143 views

PowerShell script to tail log file on multiple remote servers

I need to polish up this script. I need it to run across multiple (5 - all have the log file in the same location) Windows systems. I am having a hard time figuring out how to ensure I can "tail" the ...
0
votes
1answer
33 views

SED does not print the last input [duplicate]

I'm trying to check new lines in a file using tail, then prepend each new line with something using sed, and print the output to the standard out. The problem is, after adding a new line to the file, ...
0
votes
0answers
18 views

Error when loading the tomcat log by sudo and tail

I use this command line to see the tomcat log. $ sudo tail -f /opt/tomcat/logs/catalina.out And it always shows me the record of the tomcat, but now I did the same and it shows me this error. $ ...
0
votes
1answer
54 views

how to use tail and grep and get file name that have the result

I am using tail and grep to find something like 'Apple' on multiple files i need to get the file name that found the result in tail -F files_name grep --line-buffered -e 'Apple' -e 'Orange' while ...
0
votes
2answers
366 views

How to tail yarn logs?

I am submitting a Spark Job using below command. I want to tail the yarn log using application Id similar to tail command operation in Linux box. export SPARK_MAJOR_VERSION=2 nohup spark-submit --...
-1
votes
3answers
150 views

Tail and Head of whole dataframe in R with column and row number

Say I have a dataframe with 250 rows and 1000 columns. I want to find the 10 maximum values and the 10 minimum values, which I can easily to with tail and head function applying on the vectorised ...
2
votes
2answers
74 views

Stop Tail when a certain string is found in log file

Need to monitor a log file for a particular string "Server running at http". Once that string is found in the log file , I need to stop checking and want to continue to rest of the code. currently I ...
3
votes
1answer
186 views

tail and grep + print and exit first match

I'm looking for a 1 liner to tail a file and grep a "string", print the first match (new line) and exit. I came up with: tail -f /var/log/logfile.log -n 0 | grep -m 1 -i string_to_match actual ...
1
vote
0answers
41 views

Tail taking long time to run

When I do a tail operation it usually takes about ~0.01. However, there's one file that I have that is less than 10MB that takes about 100 times the average. Even multi-GB files finish around the '...
1
vote
2answers
53 views

Get last n lines of file — decoding error

I have a utf-16 file I'm trying to read the last few lines of. Here is what I have now: def get_last_n_lines(self, n, file=None): ''' Sorted from the bottom to the top. ''' file = ...
0
votes
0answers
31 views

Festival TTS, read last line with awk filter, using tail -f

I have been trying to make this work for a while now. Whenever a new line is written, I'd like festival to read this line for me. Now I am not sure how to do this. Ive tried piping festival with tail -...
3
votes
4answers
1k views

tail a log file from a specific line number

I know how to tail a text file with a specific number of lines, tail -n50 /this/is/my.log However, how do I make that line count a variable? Let's say I have a large log file which is appended to ...
0
votes
1answer
21 views

Bash to check cloud foundry logs

I have a CF application and running cf logs -appname- will essentially tail the logs and write the output to terminal... https://docs.cloudfoundry.org/devguide/deploy-apps/streaming-logs.html#tail-...
0
votes
2answers
35 views

Trim top and bottom rows from CSV UNIX SH

I need to trim the top 5 rows and the last row of my csv using a Unix command that I can run in a shell script. I currently have head -n -1 file.csv | tail -n +6 file.csv > newfile.csv this ...
1
vote
1answer
35 views

Why tail long file crash chrome?

My goal is to show a log file in real time. I'm doing it through a websocket, but when the paragraph ('p') of the html starts to be big (450 lines), Chrome starts lagging and crashing. The ...
-1
votes
1answer
371 views

Get catalina.out in Apache tomcat log

Currently trying to open the file gives this error: C:\Users\....\....\apache-tomcat-8.0.45\logs>catalina.out The process cannot access the file because it is being used by another process. What ...
0
votes
0answers
220 views

Tail -c linux command implementation in C

I need to write a tail in C language, where the input stream will be the argument in the console. The function should cut n characters from the input data. The command calling the program should be "...
0
votes
0answers
100 views

JavaScript: tail a local file

After reading this question I noticed - despite the initial question - the solution provided works only for remote files unless you have a webserver. Instead I'm looking for a solution (that doesn't ...
-2
votes
1answer
71 views

Interval numbers in matrix

I have a data frame with 3523 observation and 92 variables. Below an example of a data frame with 6; the 24h recording of the observations starts at 4:00am and ends 4:00am . 04:00 04:15 04:30 ...
0
votes
0answers
41 views

shell script with tail/grep not working when run via cron - Mint 18.1

Running my script in a terminal works fine. It also works fine in Mint 18.2 when run at boot via /etc/rc.local, but on Mint 18.1 it doesn't work. Also on 18.1 it won't run via sudo crontab -e. I'm ...
0
votes
1answer
78 views

Get bash sub shell output immediately from named pipe

I have a few commands i run between brackets which i then redirect to a named pipe and tail the pipe however it looks like the redirection happens only after the block has finished executing as i don'...
0
votes
1answer
194 views

Blinking text in shell script (Putty;Linux)

I am tailing a file using Putty. I have this code: tail -f /srv/ppp/ppp*.log | perl -pe 's/(TransactionID)/\e[4;38;5;255m$&\e[0m/g'; The following code makes the string "TransactionID" ...
1
vote
1answer
28 views

Custom log collection

I need to find some open source log management system for central log. The log format is unstructured on multiple host and I need to collect and send these log on central log system. The best way is ...
0
votes
0answers
30 views

Can I empty the console screen buffer when it reaches the size limit?

I have a Java program running on Windows Command Prompt (java -jar file.jar) that logs to the console and also to a file. At some point it stops showing logs in the console but not the file. I guess ...