Find the answer to your Linux question:
Results 1 to 4 of 4
Folks, I am trying to append two word in a line. I do not want to cut and store the first and second variable in two different variable and proceed. ...
  1. #1
    Just Joined! AceAll's Avatar
    Join Date
    May 2005
    Posts
    67

    Need help with one-liner

    Folks,

    I am trying to append two word in a line. I do not want to cut and store the first and second variable in two different variable and proceed. This is what i am looking for:


    Suppose, I got a word "A.C".

    I would to change it to "A.B.C.D" where B and D are the new words that needs to be added.

    Any pointers?



    -Ace

  2. #2
    Linux Engineer GNU-Fan's Avatar
    Join Date
    Mar 2008
    Posts
    935
    Have a look into the manual of GNU awk.
    Debian GNU/Linux -- You know you want it.

  3. #3
    Linux User
    Join Date
    Aug 2006
    Posts
    458
    Code:
    $ string="A.C"
    $ IFS="."
    $ set -- $string
    $ echo "$1.B.$2.D"
    A.B.C.D

  4. #4
    Just Joined! AceAll's Avatar
    Join Date
    May 2005
    Posts
    67
    Quote Originally Posted by ghostdog74 View Post
    Code:
    $ string="A.C"
    $ IFS="."
    $ set -- $string
    $ echo "$1.B.$2.D"
    A.B.C.D
    Thanks Guys!! Much appreciated.

Posting Permissions

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