How to extract many lines from a file, typically the 1000 last


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to extract many lines from a file, typically the 1000 last
# 1  
Old 11-23-2005
How to extract many lines from a file, typically the 1000 last

Hello!

Is it anyone who might know how to extract the n last lines from a file, typically the 1000 last? Until know I have used sed -n np filename, but it takes each line separately, and is hence very time consuming.

Thank you in advance!
# 2  
Old 11-23-2005
man tail.

Code:
tail -1000 file.to.extract.from

# 3  
Old 11-23-2005
tail?

$ tail -1000 filename
# 4  
Old 11-23-2005
That was fast! Thank you a lot!!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Extract a column and multiple by 1000 and replace it on same file

Hi All, I need to extract a position in the file and multiple the value by 1000 and the replace it . Original 0010001200084701217637306521200000000000010010000000 ---> 000847 * 1000 0010012700086001213437404323000000000000001001000000 ---> 000860 * 1000... (2 Replies)
Discussion started by: arunkumar_mca
2 Replies

2. UNIX for Beginners Questions & Answers

Extract lines that have entries in VI file

Dears experts i have UNIX file that contain 4 million lines , i need to extract all lines that have entiries saved in VI file , i have below comand but it takes tooooo long time : for i in `cat file1.csv`; do cat dump | grep -i $i >> file2.csv; done where : file1.csv = VI file that... (12 Replies)
Discussion started by: is2_egypt
12 Replies

3. Shell Programming and Scripting

Extract lines from a file

Hi all; Here is my file which contains a list of files (recent versions of files are in red). This file is dynamic, files versions can change at any time (versions can increment) filename ------------------------------------------------------- ... (8 Replies)
Discussion started by: chercheur111
8 Replies

4. Shell Programming and Scripting

Want to extract certain lines from big file

Hi All, I am trying to get some lines from a file i did it with while-do-loop. since the files are huge it is taking much time. now i want to make it faster. The requirement is the file will be having 1 million lines. The format is like below. ##transaction, , , ,blah, blah... (38 Replies)
Discussion started by: mad man
38 Replies

5. Shell Programming and Scripting

How to extract certain lines from a file?

Hi guys I have a several thousands line file in the following format: n817 -------------------------------------------------- n842 -------------------------------------------------- n877 -------------------------------------------------- n513 /bb/data/rmt2db.lrl:JBSKDB 31915 75... (4 Replies)
Discussion started by: aoussenko
4 Replies

6. Shell Programming and Scripting

Extract particular lines from a file

Hi all, I have a file with many records with information as given below ID A16L2_HUMAN Reviewed; 619 AA. AC Q8NAA4; A5PL30; B2RPK5; Q658V4; Q6PID3; Q8NBG0; DT 20-MAY-2008, integrated into UniProtKB/Swiss-Prot. DT 20-MAY-2008, sequence version 2. DT ... (1 Reply)
Discussion started by: kaav06
1 Replies

7. Shell Programming and Scripting

Extract some lines from one file and add those lines to current file

hi, i have two files. file1.sh echo "unix" echo "linux" file2.sh echo "unix linux forums" now the output i need is $./file2.sh unix linux forums (3 Replies)
Discussion started by: snreddy_gopu
3 Replies

8. Shell Programming and Scripting

extract particular lines from text file

I have two files file A which have a number in every row and file B which contains few hundred thousand rows with about 300 characters in each row (csv) What I need is to extract whole rows from B file (only these which numbers are indicated in A file) I also need to use cygwin. Any... (7 Replies)
Discussion started by: gunio
7 Replies

9. Shell Programming and Scripting

To extract the required lines from a file

I have a files in a directory in this format data data data ---BEGIN CERT----- data data data ---END CERT ----- Now, I want to extract the lines starting from --BEGIN CERT-- and write the contents till the end of file into a new file.How can I do this for all the files in the... (1 Reply)
Discussion started by: sureshg
1 Replies

10. Shell Programming and Scripting

Extract lines from a file automatically. Please a Help

hello, hope you can help me: ive got a file called archivos The content or structure of this file is ./chu0/filechu ./chu1/filechu I extract each line from this file manually and redirect to a file, and it Works fine, so the command line is: awk ‘/chu0/ {print $0}' < archivos >... (8 Replies)
Discussion started by: alexcol
8 Replies
Login or Register to Ask a Question