If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > Shell script to find a block of lines

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-21-08, 08:39
asram asram is offline
Registered User
 
Join Date: Jul 2003
Posts: 34
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.
Reply With Quote
  #2 (permalink)  
Old 09-04-08, 06:44
yacovbm yacovbm is offline
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old 09-04-08, 06:47
yacovbm yacovbm is offline
Registered User
 
Join Date: Aug 2008
Posts: 3
do the following

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

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On