Results 1 to 2 of 2

Thread: sed problem

  1. #1
    Join Date
    Feb 2006
    Posts
    31

    Unanswered: sed problem

    I want to get the output in the form

    DATE/TIme FILENAME

    May 2 05:14 www.log

    The space between the time value and file name should be three tab spaces. if I try to use the command sed 's/ */ /g' then all the spaces are filled with tab spaces....how do I get the tab spaces just before the file name.

  2. #2
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    Try this
    Code:
    # cat /tmp/f1                                                            
    Apr 30 05:14 www.log
    May  2 06:14 some file with spaces in the name
    # sed 's/\(............\) \(.*\)/\1                     \2/' /tmp/f1
    Apr 30 05:14                    www.log
    May  2 06:14                    some file with spaces in the name
    Or
    Code:
    # sed 's/\(.*\):\(..\) \(.*\)/\1:\2                     \3/' /tmp/f1
    Apr 30 05:14                    www.log
    May  2 06:14                    some file with spaces in the name

Posting Permissions

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