Results 1 to 2 of 2

Thread: delete first 3charachters of file sed or awk

  1. #1
    Join Date
    Sep 2006
    Beans
    90

    delete first 3charachters of file sed or awk

    i wanna delete just the 3 first carachters of this file,

    i try sed but it only didn't find a way of doing it

    sed '^3//d'

    file

    asdffsd
    sdfgdhd
    hdfhdhd

  2. #2
    Join Date
    Sep 2007
    Location
    Norwich, UK
    Beans
    964

    Re: delete first 3charachters of file sed or awk

    Try this:

    Code:
    sed -i 's/^...//' file
    The -i allows inline editing of the file. The . will find any character, so three of them will find three characters.

    This won't work if the file has less than three characters in it, because it explicitly looks for three characters - if it doesn't find them, it won't delete them.

    If this is going to be a problem, let me know and I'll see what I can come up with.

    Steve.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •