LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 01-18-2011, 11:26 PM   #1
shravee
Member
 
Registered: Sep 2009
Posts: 75

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

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

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
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
 
Old 01-19-2011, 06:00 AM   #3
prakasha.lunux
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
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
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
shravee
Member
 
Registered: Sep 2009
Posts: 75

Original Poster
Rep: Reputation: 15
thanks all,

I got it working from MS3FGX..

rgds
Shravan
 
  


Reply


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


All times are GMT -5. The time now is 03:04 PM.

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