Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-18-2011, 11:26 PM   #1
Registered: Sep 2009
Posts: 76

Rep: Reputation: 15
Post 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

Old 01-18-2011, 11:33 PM   #2
LQ Guru
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

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

tail -50 sample.log >> new.log
Old 01-19-2011, 06:00 AM   #3
LQ Newbie
Registered: Jan 2011
Posts: 25

Rep: Reputation: 0
U can try this way also...

#scp sample.log newfile.log
Old 01-19-2011, 07:10 AM   #4
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677
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.
Old 02-02-2011, 09:30 PM   #5
Registered: Sep 2009
Posts: 76

Original Poster
Rep: Reputation: 15
thanks all,

I got it working from MS3FGX..



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
copy the file whose source path is mentioned in a file to the specified Destination bluepenguine Linux - General 1 06-03-2010 06:31 AM
copy last 10000+ lines of large text file to a temporary file emilyg Linux - Newbie 3 06-24-2009 03:43 PM
i cannot copy a file to a folder in file system with my root account realbezo Linux - Newbie 4 03-03-2009 11:45 PM
copy vid tape to file and burn file to DVD jim mann Linux - Software 4 01-24-2006 10:57 PM
Is arrangement of file systems will differ if we copy a file from FAT 32 to ext 3 ? anindyanuri Linux - Software 2 02-20-2005 12:39 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:20 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration