Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add text before lines in command output 1

Status
Not open for further replies.

UsRb

IS-IT--Management
Mar 19, 2007
48
HR
Hi2all,

I have following command in HMC:
lssyscfg -r prof -m Server-9117-MMA-SN655D350 -F lpar_name,min_mem,desired_mem --header

which gives me the following output:

lpar_name,min_mem,desired_mem
lpar1,1024,2048
lpar2,1024,2048
lpar3,2048,4096

What I want is to add in the begining of every line starting from lpar1, name of the Complex. How can I achieve this?

 
What is HMC ? What is the Complex ?
Just a guess:
Code:
lssyscfg -r prof -m Server-9117-MMA-SN655D350 -F lpar_name,min_mem,desired_mem --header |
 awk '{print x","$0;x="name of the Complex"}'

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
HMC is IBM pseries hardware management console and Complex is a server box, it doesn't matter however.

Thank you for your answer, it helped me.
 
I have one more question similar to last one.

If my first command output is 5 lines:
lpar1,1024,2048
lpar2,1024,2048
lpar3,2048,4096
lpar4,2048,8192
lpar5,512,1024

Now I execute second command which gives me another 5 lines
1,2,3
2,3,4
3,4,5
4,5,6
5,6,7

I want to add second command's output so it will all be in one line, like this:

lpar1,1024,2048,1,2,3
lpar2,1024,2048,2,3,4
lpar3,2048,4096,3,4,5
lpar4,2048,8192,4,5,6
lpar5,512,1024,5,6,7

How is this possible to do?
Thanx
 
I want this to automatically run in script.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top