Solved

korn script help - AIX

Posted on 2012-04-12
6
279 Views
Last Modified: 2012-04-12
I have a list of LUN ID's
002D8
007A6
01245
0079E
0008E
00796
0008D
0077B
002E0
00773
00969
0076B

How do I convert into an output like this
# command " 002D8 | 007A6 | 01245 | 0079E | 0008E | 00796 | 0008D | 0077B | 002E0 | 00773 | 00969 | 0076B"
0
Comment
Question by:mnis2008
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 37838632
awk '{if(NR==1) printf "#command \"%s | ", $0; else printf "%s | ", $0} END {print "\b\b\""} lunlist
0
 
LVL 14

Expert Comment

by:sjm_ee
ID: 37838642
cat <<! | tr "\n" "|" | sed -e "s/|/ | /g"
002D8
007A6
01245
0079E
0008E
00796
0008D
0077B
002E0
00773
00969
0076B
!
0
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 500 total points
ID: 37838660
Sorry,

I forgot the closing single quote!

awk '{if(NR==1) printf "#command \" %s | ", $0; else printf "%s | ", $0} END {print "\b\b\""}' lunlist
0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

Author Comment

by:mnis2008
ID: 37839267
Hello WMP

Thanks for your help but I wanted to output with no spaces
# command " 002D8|007A6|01245|0079E|0008E|00796|0008D|0077B|002E0|00773| 00969|0076B"

I copied and pasted from a notepad and some how we got this spaces ...
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 37839321
No problem.

awk '{if(NR==1) printf "# command \"%s|", $0; else printf "%s|", $0} END {print "\b\""}' lunlist

I removed the space between the first quotation mark and the first LUN ID as well. Hope that's OK.
0
 

Author Comment

by:mnis2008
ID: 37839396
thanks, works now
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question