Generate command with awk


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Generate command with awk
# 1  
Old 06-15-2010
Lightbulb Generate command with awk

Hello,
I have the line underneath generated by lssyscfg command:

Code:
"""51/client/1/pcyaz0hjfv00-vio1/651/c050760107fd0466,c050760107fd0467/1"",""52/client/2/pcyaz0hjfv01-vio2/652/c050760107fd0468,c050760107fd0469/1"",""31/client/1/pcyaz0hjfv00-vio1/375/c050760107fd046a,c050760107fd046b/1"""

With a awk, i would like to generate Three command:

Code:
First command -->chsyscfg -r prof -m SDIN_E06-9119-FHA-5182D94 -i name=pcyaz0hrfv70_zsi,lpar_name=pcyaz0hrfv70-E1NA-B-MICADO_DATA-2,\"virtual_fc_adapters=\"\"51/client/1/pcyaz0hjfv00-vio1/651/c050760107fd0468,c050760107fd0469/1\"\"\"


Second command --> chsyscfg -r prof -m SDIN_E06-9119-FHA-5182D94 -i name=pcyaz0hrfv70_zsi,lpar_name=pcyaz0hrfv70-E1NA-B-MICADO_DATA-2,\"virtual_fc_adapters+=\"\"52/client/2/pcyaz0hjfv01-vio2/652/c050760107fd0466,c050760107fd0467/1\"\"\"

last command --> chsyscfg -r prof -m SDIN_E06-9119-FHA-5182D94 -i name=pcyaz0hrfv70_zsi,lpar_name=pcyaz0hrfv70-E1NA-B-MICADO_DATA-2,\"virtual_fc_adapters+=\"\"31/client/1/pcyaz0hjfv00-vio1/375/c050760107fd046a,c050760107fd046b/1\"\"\"

I want to reverse the character red with blue et blue with red for the thirst an d second command with a "+" in "virtual_fc_adapters+="
# 2  
Old 06-15-2010
As a start:
Code:
awk -F"[,/]" '{print $6,$7,$14,$15}' infile
c050760107fd0466 c050760107fd0467 c050760107fd0468 c050760107fd0469

With now knowing the field positions you can enhance your print with the rest of your commands and place the field positions as neeed.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

awk use to generate report

Hi , In a directory list of ddl files are stored in the given format above. Above is the sample ddl file. The ddl file name is same as that of table name ie email_notifications.ddl I want to generate below report using awk utility reading all the ddl files stored in /ddl path Desired output:... (1 Reply)
Discussion started by: vedanta
1 Replies

2. Shell Programming and Scripting

Generate sorted awk array for further processing

Hello to all, I have and input file like this: Objects (id: bounding-box centroid area mean-color): 0: 800x800+0+0 406.6,390.9 378792 srgb(0,0,0) 11: 240x151+140+624 259.5,699.0 36240 srgb(255,255,255) 6: 240x151+462+176 581.5,251.0 36240 srgb(255,255,255) 7: 240x151+87+257... (2 Replies)
Discussion started by: Ophiuchus
2 Replies

3. Shell Programming and Scripting

To get older than last 7days records using awk scripting to generate report and send email

Hello All, I have need as below: 1--> I need to get all users(who submit jobs) and their details by using below command: qstat -u \* output of the above command looks line below: job-ID prior name user-id state "submit/start at" queue jclass slots ja-task-ID... (5 Replies)
Discussion started by: VasuKukkapalli
5 Replies

4. UNIX for Dummies Questions & Answers

Read the file and generate specific fields by awk

Hi I need to generate these output file from the below input file. Output : customer_id as customer, zip as zip_cd, catg_cd as catg, Input: out.customer::in.customer_id; out.zip_cd::in.zip; out.catg::in.catg_cd; Could you please help me on this. Please use code tags next... (1 Reply)
Discussion started by: Murugesh
1 Replies

5. Shell Programming and Scripting

awk command in script gives error while same awk command at prompt runs fine: Why?

Hello all, Here is what my bash script does: sums number columns, saves the tot in new column, outputs if tot >= threshold val: > cat getnon0file.sh #!/bin/bash this="getnon0file.sh" USAGE=$this" InFile="xyz.38" Min="0.05" # awk '{sum=0; for(n=2; n<=NF; n++){sum+=$n};... (4 Replies)
Discussion started by: catalys
4 Replies

6. Shell Programming and Scripting

help....generate command script

Please help..... if i have a file list below : 1233743158.log 1233743410.log 1233744186.log 1233744462.log "1233743158" is a unix time format it's require to a script "convertime.sh" to convert unix time format to readable time format like 20090204183010 -- YYYYMMDDHHMMSS ... (10 Replies)
Discussion started by: bleach8578
10 Replies

7. UNIX for Dummies Questions & Answers

generate CSV file using AWK script

Hi guys I have a text report that consists of text in some parts and data in some parts. e.g Report for changes in cashflows No changes were found Report for changes in Bills deal_num deal_date trader maturity log_creator DF_234 20-5-2008 tman 20-5-2009 tman... (2 Replies)
Discussion started by: magikminox
2 Replies

8. Shell Programming and Scripting

AWK: generate new line number

Hi. I have a script wich reads 1 file and generates 4. If the original file has 10 lines the the sum of the 4 generated files must have the 10 original lines. So far this works. Now what I need is to numerate the lines wtithin each generated file. I tried with NR but it prints the line... (2 Replies)
Discussion started by: mrodrig
2 Replies

9. Shell Programming and Scripting

Requesting an AWK code to generate averaged rows in a column

Hello, I request your kind help in solving this problem... I have a file with two columns and "n" number of rows. For the first column, it won't be change. For the second column, I want to take the average of the first three rows. Then assign the averaged value to the first three rows. This... (8 Replies)
Discussion started by: solracq
8 Replies
Login or Register to Ask a Question