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.

Depending on the context tail may refer to:

  • the part of a list that comes after the head i.e. the list you obtain when you remove the first element.

  • the tail unix command which displays the last lines of a file. It's counterpart which displays the first lines is head (). Example: tail -n 10 file will output last 10 lines of file.


See also:

1032 questions
-2
votes
1 answer

Need help using TAIL and SED to find a string pattern and use part of that string pattern as a variable

What I need is to monitor the last line of a file (more specificly the latest.log file for a Minecraft server) and test to see if it contains any predetermined strings. Example: I want to see when a specific player says a certain string. When the…
-2
votes
1 answer

Unix - Tail Utility would open the file or not

Can anybody help me to sort this out. What is the logic of Tail -f utility in Unix. Is it open the log file to check the updated content or is there any other way to get this information. All the implimentation of Tail utility says that it will open…
hhsecond
  • 62
  • 7
-2
votes
1 answer

Unix tail program in C using an implemented function

I have implemented my own dynamic-memory version of getline function: char * fgetline(FILE * f) Starts with 30 character buffer and when the buffer is full allocate a new one copy the contents and free the old buffer. When we get EOF or \n we…
kokosg
  • 123
  • 3
  • 11
-3
votes
2 answers

how to save arithmetic expression into a variable in shell?

I want to save the number of lines minus 2 into a shell variable. I have tried this: eval a = wc -l meny1.xml | awk '{print $1} tail a-2 meny1.xml >> tmp for saving the number of line of a file and then decrease it by 2. but it doesn't do the…
Elad Benda2
  • 13,852
  • 29
  • 82
  • 157
-3
votes
1 answer

Automatic reopening file for reading if it was recreated

There is some (compiled and not my) program A, which starts .log file from the beginning each time, when I launch it. And I wrote the program B to work with this log using this approach: File.open("qconsole.log") do |log| log.gets nil # I am…
Nakilon
  • 34,866
  • 14
  • 107
  • 142
-4
votes
3 answers

C program to write last few lines of program, seek error?

I was trying to write a code in c after long time, objective of program is to 1) print the last 10 lines of text file which is received as arguements. 2) display errors otherwise there is a problem with seek command which is got lost correcting it.…
Abhilash Muthuraj
  • 2,008
  • 9
  • 34
  • 48
-4
votes
1 answer

Will head() and tail() functions in R change the order of output?

I know head() and tail() function will return the first or last parts of a dataset, but I wanna know if the two functions are gonna order the output, or just return without ordering them? Thanks many in advance!
Chris
  • 87
  • 10
-5
votes
2 answers

Head() is not showing the result

import pandas as pd df = pd.read_csv("stock_data.csv") df.head() Is not showing the result: suggestion for improvement?
-5
votes
2 answers

Issue with returning the last 10 lines of a file in PHP

Currently, I have this code to return the last 10 lines in the file: food.txt
-5
votes
2 answers

Haskell convert "case of" statement to tail recursive code

I need help. I have a function of that form myFunction = case myFunction of (Nothing) -> (Just) (Just) -> (Just) I want to make it tail recursive. How would one do it ? I understand that the fact we have a different statement according to…
-6
votes
1 answer

OCaml: How can I return the first element of a list and after that remove it from the list?

I tried to use List.hd and List.tl for this task: let takeCard fst deck = fst = List.hd deck List.tl deck List.hd takes two arguments but I don't understand why.
Gonzalo Garcia
  • 6,192
  • 2
  • 29
  • 32
-7
votes
1 answer

what is the function of each of these lines?

head -$4 $5 > temp head -$2 $3 | tail -n +$1 >> temp tail -n +$(expr $4 +1) $5>> temp This is a problem using head and tail. I need a description of each line please thank!
1 2 3
68
69