Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2003
    Posts
    34

    Unanswered: Shell script to find a block of lines

    Hi,

    Please help me in the following assignment.

    [USER_1]
    Name=user1
    SSN=6789
    Number= 1234

    [USER_2]
    Name=user2
    SSN=5790
    Number=2098

    and so on.

    I would like to get the following output from the above file:
    [USER_1], SSN=6789
    [USER_2], SSN=5790
    --
    --

    Appreciate your help.

  2. #2
    Join Date
    Aug 2008
    Posts
    3

    Smile

    Quote Originally Posted by asram
    Hi,

    Please help me in the following assignment.

    [USER_1]
    Name=user1
    SSN=6789
    Number= 1234

    [USER_2]
    Name=user2
    SSN=5790
    Number=2098

    and so on.

    I would like to get the following output from the above file:
    [USER_1], SSN=6789
    [USER_2], SSN=5790
    --
    --

    Appreciate your help.
    do the following

    awk 'BEGIN{RS=" "}{print $1","$3}' f1 > f2

  3. #3
    Join Date
    Aug 2008
    Posts
    3
    do the following

    awk 'BEGIN{RS=" "}{print $1","$3}' f1 > f2

Posting Permissions

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