[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

korn script help - AIX

Posted on 2012-04-12
6
Medium Priority
?
284 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
  • 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 2000 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month19 days, 21 hours left to enroll

872 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