Search Results

Search: Posts Made By: alen192
1,357
Posted By Chubler_XL
or this $ awk -F: '/^ #/ {a=$2;next}{print...
or this
$ awk -F: '/^ #/ {a=$2;next}{print "zoneAdd \"" $0 "\",\"" a "\""}' infile
zoneAdd "p_CGBVMH1_FC0; p_EVA1_CTRL_A_1","z_CGBVMH1_FC0_to_EVA1_CTRL_A_1"
zoneAdd "p_CGBVMH1_FC0;...
1,357
Posted By jayan_jay
Based on the input given .. $ nawk -F:...
Based on the input given ..

$ nawk -F: '/^#/{print "zoneAdd \""$2"\""}!/^#/{print "\""$0"\""}' infile | paste -d',' - -
zoneAdd "z_CGBVMH1_FC0_to_EVA1_CTRL_A_1","p_CGBVMH1_FC0; p_EVA1_CTRL_A_1"...
3,898
Posted By panyam
/objectname/ {f1=1;o=$2;next} --> if "objectname"...
/objectname/ {f1=1;o=$2;next} --> if "objectname" present in a line store second field in variable "o" and set f1 flag


repeat the same login for other variables as well.

Once all the four...
3,898
Posted By panyam
How about this ? awk -F":" ' ...
How about this ?


awk -F":" '
/objectname/ {f1=1;o=$2;next}
/wwlunid/ {f2=1;w=$2;next}
/allocatedcapacity/ {f3=1;a=$2;next}
/redundancy/ {f4=1;r=$2;next}
...
2,305
Posted By danmero
paste can do the job # paste -d\, - - - - <...
paste can do the job
# paste -d\, - - - - < file
item1,attribute1 item1,attribute2 item1,attribute3 item1
item2,attribute1 item2,attribute2 item2,attribute3 item2
Or use awk
awk '{printf...
2,305
Posted By neutronscott
OK! Array's are not needed. This is more readable...
OK! Array's are not needed. This is more readable ;)


[mute@sunny ~]$ nawk 'NR%4 {printf $0",";next} 1' attr
item1,attribute1 item1,attribute2 item1,attribute3 item1
item2,attribute1...
Showing results 1 to 6 of 6

 
All times are GMT -4. The time now is 08:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy