#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2004
    Posts
    19
    Rep Power
    0

    How to delete the first 10 lines in a text file?


    In c shell script, I need to delete the first 10 lines in every input text file.


    Thanks for you help.

    Thanh
  2. #2
  3. No Profile Picture
    ......@.........
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jun 2004
    Posts
    1,345
    Rep Power
    59
    one way:
    Code:
    tail -n +10 filename > tmp.tmp
    mv tmp.tmp filename
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Location
    USA
    Posts
    334
    Rep Power
    14
    Another way:

    sed -e '1,10d' filename > tmpfile
    mv tmpfile filename
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2004
    Posts
    19
    Rep Power
    0
    Thanks so much!
    Both answers work great!

IMN logo majestic logo threadwatch logo seochat tools logo