LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Blogs > dinakumar12
User Name
Password

Notices



  1. Old Comment

    Simple script to delete last n lines

    Using this script i am deleting last three lines from a file

    Here in this case, my script and the file in which the lines to be deleted are in the same location.

    so simply run

    ./script or sh -x script

    so that last three lines from filename called file would be deleted.

    Note : the filename is mentioned in the script itself, if your file is in someother location just edit the script as
    "sed -i '$d' path_to_the_file_whose_lines_to_be_deleted" and run the script.
    Posted 12-31-2013 at 02:22 AM by dinakumar12 dinakumar12 is offline
    Updated 12-31-2013 at 02:27 AM by dinakumar12
  2. Old Comment

    Simple script to delete last n lines

    how to using the script,
    It's getting parameter or have to defile file path in script, or what else?
    I think, you have to give a sample to understandable.

    for example,
    should write command like following to delete last 3 lines of file.txt

    # script.sh file.txt

    Regards
    Posted 11-02-2013 at 01:44 PM by idogan idogan is offline

  



All times are GMT -5. The time now is 09:00 PM.

Main Menu
Advertisement

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration