Solved

korn script help - AIX

Posted on 2012-04-12
6
275 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:mnis2008
Comment Utility
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
Comment Utility
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
Comment Utility
thanks, works now
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
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…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

762 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now