LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   copy one file to different file (https://www.linuxquestions.org/questions/linux-newbie-8/copy-one-file-to-different-file-857167/)

shravee 01-18-2011 10:26 PM

copy one file to different file
 
hi all,

I have a sample.log file which contains 100 lines. I need to copy last 50 lines from this file to a new text file. how can I do this. ?
Plz help ....

thanks in advance

regards
Shravan

MS3FGX 01-18-2011 10:33 PM

There are many ways you could do this, but the first thing that pops into my head is:

Code:

tail -50 sample.log >> new.log

prakasha.lunux 01-19-2011 05:00 AM

U can try this way also...

#scp sample.log newfile.log

jschiwal 01-19-2011 06:10 AM

Using scp you will copy the file in it's entirety and there would be no reason to use scp over cp. Since you don't need to copy to another host using ssh.

shravee 02-02-2011 08:30 PM

thanks all,

I got it working from MS3FGX..

rgds
Shravan


All times are GMT -5. The time now is 08:32 PM.