Unix/Linux Go Back    


Shell Programming and Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and shell scripts and shell scripting languages here.

How to concatenate list of ID's?

Shell Programming and Scripting


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 01-30-2013
buzzme buzzme is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 14 November 2015, 1:17 PM EST
Posts: 57
Thanks: 15
Thanked 0 Times in 0 Posts
How to concatenate list of ID's?

Hi
I have attached list of id's and i need like below using shell script.

Input:

Code:
uid=c232346uid=c232408uid=c232438uid=c232584uid=c232587uid=c232635uid=c232637uid=c232732uid=c233003uid=c245377uid=c277345

output needed:


Code:
(uid=c232346)(uid=c232408)(uid=c232438)(uid=c232584)(uid=c232587)(uid=c232635)(uid=c232637)(uid=c232732)(uid=c233003)(uid=c245377)(uid=c277345)

Attached Files
File Type: txt list if id's.txt (14.5 KB, 12 views)

Last edited by Scrutinizer; 01-30-2013 at 04:56 PM.. Reason: code tags
Sponsored Links
    #2  
Old Unix and Linux 01-30-2013
Scrutinizer's Unix or Linux Image
Scrutinizer Scrutinizer is offline Forum Staff  
Moderator
 
Join Date: Nov 2008
Last Activity: 31 August 2016, 5:33 PM EDT
Location: Amsterdam
Posts: 10,988
Thanks: 427
Thanked 3,037 Times in 2,699 Posts
The format of your list of id's differs from your input specification..
Sponsored Links
    #3  
Old Unix and Linux 01-30-2013
Chubler_XL's Unix or Linux Image
Chubler_XL Chubler_XL is offline Forum Staff  
Moderator
 
Join Date: Oct 2010
Last Activity: 31 August 2016, 10:48 PM EDT
Posts: 3,277
Thanks: 128
Thanked 1,106 Times in 1,031 Posts
Try this:


Code:
awk '/^uid=/ { printf "(%s)", $0} END { print "" }' "list if id's.txt"

Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
concatenate variables HackerSeabass Shell Programming and Scripting 4 02-18-2012 05:09 AM
Concatenate two lines in one Orbix Shell Programming and Scripting 5 04-29-2010 04:40 PM
Splitting a list @list by space delimiter so i can access it by using $list[0 ..1..2] shriyer Shell Programming and Scripting 1 07-29-2009 02:05 PM
How to concatenate all files. s80bob UNIX for Dummies Questions & Answers 1 08-22-2005 04:20 PM
Asking on concatenate variable blueberry80 UNIX for Dummies Questions & Answers 3 07-25-2003 09:46 AM



All times are GMT -4. The time now is 01:36 AM.