Visit Our UNIX and Linux User Community


copy and paste certain many lines of huge file in linux


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers copy and paste certain many lines of huge file in linux
# 1  
Old 08-12-2009
copy and paste certain many lines of huge file in linux

Dear All,

I am working with windoes OS but remote a linux machine. I wonder the way to copy an paste some part of a huge file in linux machine.

the contain of file like as follow:

...
dump annealling all custom 10 anneal_*.dat id type x y z q

timestep 0.02
run 200000
Memory usage per processor = 3.00831 Mbytes
Step PotEng TotEng Temp Press
0 -131593.2 -131593.2 0 -366874.47
1 -131593.21 -130252.7 300.0085 -364406.93
2 -131600.16 -130259.62 300.017 -358658.77
3 -131607.06 -130266.48 300.0255 -352910.17
4 -131613.76 -130273.14 300.034 -347161.71
5 -131620.4 -130279.74 300.0425 -341413.54

undump annealing
6 -131626.83 -130286.13 300.051 -335666.21
7 -131633.21 -130292.48 300.0595 -329919.85
8 -131639.43 -130298.66 300.068 -324175
9 -131645.52 -130304.7 300.0765 -318431.95
10 -131651.44 -130310.59 300.085 -312691.1
...

I want to copy and paste data from 1 to 5( between senteces "step ..." and "undump unnealing".
Of course its easy by using clicking mouse right in case it is only 5 lines. But what I want to do is copy and paste more than 10.000 lines.

I highly appreciate any help from you
thank you in advance
# 2  
Old 08-13-2009
If you know both the line numbers then you can easily do it using sed.

sed.

Code:
sed -n '<start Line no>,<End Line No> p' File_name > new_file_name

# 3  
Old 08-16-2009
thank you for your helping me
 

Previous Thread | Next Thread
Test Your Knowledge in Computers #594
Difficulty: Easy
In the C programming language, variables are scoped to the code block in which they are declared and are only valid within that code block.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash copy and paste text in file from one position to another

Hi I have a text file with lines beginning with 71303, 71403, 71602, I need to copy the 10 digit text at position 30 on lines beginning with 71303 (5500011446) to position 99 on every line beginning with 71602 (see example below), There may be many 71303 lines but I need the text copying to... (2 Replies)
Discussion started by: firefox2k2
2 Replies

2. Shell Programming and Scripting

Copy and paste text inside a xml file

I have a really big XML file. I need copy the value of one tag inside another one tag. I try to publish one example. <channel update="i" site="merge-xmltv" site_id="" xmltv_id="Rai 1">Rai 1</channel> <channel update="i" site="merge-xmltv" site_id="" xmltv_id="Rai 1 +2HD">Rai 1... (6 Replies)
Discussion started by: Tapiocapioca
6 Replies

3. UNIX for Dummies Questions & Answers

Copy Lines between Keywords & paste them to another file

hi, I have Multiple files with the following data : File1 100414 DR1 END XXXXX Test1 Test2 Test3 Test4 Test5 Test6 END 100514 DR2 END XXXXX Test7 Test8 Test9 Test10 Test11 Test12 END 100614 DR3 (5 Replies)
Discussion started by: newageBATMAN
5 Replies

4. Shell Programming and Scripting

Copy a column and paste to other file question

Please help me. This is simple, but urgent problem for me. :( I have a two files file1 1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6 ..... file2 11 12 13 14 15 11 12 13 14 15 11 12 13 14 15 ..... 1) I hope to make a new file, file 3, that consists of 2nd... (2 Replies)
Discussion started by: exsonic
2 Replies

5. Shell Programming and Scripting

how to split a huge file by every 100 lines

into small files. i need to add a head.txt and tail.txt into small files at the begin and end, and give a name as q1.xml q2.xml q3.xml .... thank you very much. (2 Replies)
Discussion started by: dtdt
2 Replies

6. UNIX for Advanced & Expert Users

In a huge file, Delete duplicate lines leaving unique lines

Hi All, I have a very huge file (4GB) which has duplicate lines. I want to delete duplicate lines leaving unique lines. Sort, uniq, awk '!x++' are not working as its running out of buffer space. I dont know if this works : I want to read each line of the File in a For Loop, and want to... (16 Replies)
Discussion started by: krishnix
16 Replies

7. Shell Programming and Scripting

Copy and Paste Columns in a Tab-Limited Text file

I have this text file with a very large number of columns (10,000+) and I want to move the first column to the position of the six column so that the text file looks like this: Before cutting and pasting ID Family Mother Father Trait Phenotype aaa bbb ... (5 Replies)
Discussion started by: evelibertine
5 Replies

8. Solaris

Copy and paste text from a word document into a txt file in vi

Hello, Can anybody please tell me how we can copy and paste text from a word document into a text file that we are editing in vi? Is it possible to do that while we are editing the text file in vi in insert mode? Thanks, (3 Replies)
Discussion started by: Pouchie1
3 Replies

9. Shell Programming and Scripting

awk/grep copy and paste and insert in between lines.

Hi all, I'm a unix newb andI'm trying to write a script that can copy some text paste it in a certian place and then add a number. It's not really clear but I'll show an example. what the file looks like right now: Linux 2.6.24-24-generic (abc) 07/15/09 23:25:01 CPU ... (6 Replies)
Discussion started by: the1hand3r
6 Replies

10. Shell Programming and Scripting

Delete lines from huge file

I have to delete 1st 7000 lines of a file which is 12GB large. As it is so large, i can't open in vi and delete these lines. Also I found one post here which gave solution using perl, but I don't have perl installed. Also some solutions were redirecting the o/p to a different file and renaming it.... (3 Replies)
Discussion started by: rahulrathod
3 Replies

Featured Tech Videos