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

    Join Date
    Dec 2012
    Posts
    1
    Rep Power
    0

    Search - Verify and Replace


    Hello All,

    I am fairly new to Unix and looking for a solution for a below prob
    Content of a file x

    223001ABCD
    2210015ABCD
    221007ABCD
    2230015ABCD
    223004ABCD

    I am looking for a way where I need to search in the file
    1. First for Unit Code - '223' ( Position 1 to 3)
    2. If Position 6 is '1' & Position 7 between '0' & '5'
    do nothing
    else
    Add space on position 6

    The Modified output inside file x
    22300 1ABCD
    2210015ABCD
    221007ABCD
    2230015ABCD
    22300 4ABCD
  2. #2
  3. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2006
    Posts
    840
    Rep Power
    387

    Wink


    Originally Posted by Unixnew
    Hello All,

    I am fairly new to Unix and looking for a solution for a below prob
    Content of a file x
    . . . Etc . . .
    Good homework assignment!
    Easy to solve if your teacher allows you to use 'awk'.

    Good luck!

IMN logo majestic logo threadwatch logo seochat tools logo