mnis2008
asked on
korn script help - AIX
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"
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"
awk '{if(NR==1) printf "#command \"%s | ", $0; else printf "%s | ", $0} END {print "\b\b\""} lunlist
cat <<! | tr "\n" "|" | sed -e "s/|/ | /g"
002D8
007A6
01245
0079E
0008E
00796
0008D
0077B
002E0
00773
00969
0076B
!
002D8
007A6
01245
0079E
0008E
00796
0008D
0077B
002E0
00773
00969
0076B
!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hello WMP
Thanks for your help but I wanted to output with no spaces
# command " 002D8|007A6|01245|0079E|00 08E|00796| 0008D|0077 B|002E0|00 773| 00969|0076B"
I copied and pasted from a notepad and some how we got this spaces ...
Thanks for your help but I wanted to output with no spaces
# command " 002D8|007A6|01245|0079E|00
I copied and pasted from a notepad and some how we got this spaces ...
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.
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.
ASKER
thanks, works now