Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2007
    Posts
    1

    Unanswered: how to remove leading and trailing space from a file

    hi,
    i want to remove the leading and trailing space from a file
    likewise

    output of the finger command will b ein format of:

    Login Name Tty Idle Login Time Office Office Phone

    where there will be variable number of space in between login and name field.

    i want to make all the fields separated by just one white space, so i can use cut command with the delimiter whitespace to extract each separated field.
    my problem is i dont have to use sed or awk commands to do this script. please help me.

    your help is highly apreciated.

    many thanks
    Last edited by gauranggandhi; 10-25-07 at 13:48.

  2. #2
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    Quote Originally Posted by gauranggandhi
    problem is i dont have to use sed or awk
    I guess you mean you are not allowed to use awk or sed in this homework assignment. What commands have you learned so far? Maybe use tr -s

Posting Permissions

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