Find the answer to your Linux question:
Results 1 to 4 of 4
Hello all, Is there anyway to delete the first 6 characters on each line of a file using sed or awk? Thanks....
  1. #1
    Just Joined!
    Join Date
    Mar 2006
    Posts
    25

    sed & awk question

    Hello all,

    Is there anyway to delete the first 6 characters on each line of a file using sed or awk? Thanks.

  2. #2
    Just Joined!
    Join Date
    Aug 2007
    Posts
    37
    Here are two ways to do it with sed:
    Code:
    sed 's/^......//' input_file
    sed 's/^.\{6\}//' input_file

  3. #3
    Just Joined!
    Join Date
    Mar 2006
    Posts
    25
    Thank you every much. You saved half of my working day.

  4. #4
    Linux User
    Join Date
    Aug 2006
    Posts
    458
    in awk
    Code:
    awk '{print substr($0,7)}' file

Posting Permissions

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