![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| I want to print next 3 lines after pattern matching. | naree | Shell Programming and Scripting | 12 | 05-21-2009 04:04 AM |
| counting the lines matching a pattern, in between two pattern, and generate a tab | d.chauliac | Shell Programming and Scripting | 4 | 03-19-2009 01:30 PM |
| Perl script to match a pattern and print lines | ammu | Shell Programming and Scripting | 6 | 12-22-2008 04:26 AM |
| Print block of lines matching a pattern | vanand420 | Shell Programming and Scripting | 1 | 09-29-2008 06:09 AM |
| pattern matching and print with sed | nymus7 | Shell Programming and Scripting | 2 | 04-14-2005 10:36 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Quote:
Hey this just cooool..... thnx a lot .....---------- Post updated at 05:04 PM ---------- Previous update was at 01:42 PM ---------- Quote:
InputFile: add_cell 4 0 4 6 9 106 1311 2 frequency_type = 1 bsic = 2Ah wait_indication_parameters = 10 ccch_conf = 0 add_cell 4 0 4 6 9 106 1312 2 frequency_type = 1 bsic = 3Ah wait_indication_parameters = 10 ccch_conf = 0 equip 1 RTF FULL BCCH 0 0 0 4 0 4 6 9 106 1311 69 255 255 255 255 255 255 255 255 equip 1 RTF FULL BCCH 1 0 0 4 0 4 6 9 106 1312 77 255 255 255 255 255 255 255 255 equip 1 RTF FULL NON_BCCH 0 2 0 4 0 4 6 9 106 1311 82 0 0 0 0 0 0 0 0 chg_element hopping_systems_enabled,0 1 2 cell_number = 4 0 4 6 9 106 1312 chg_element hopping_systems_enabled,1 1 2 cell_number = 4 0 4 6 9 106 1312 chg_element hopping_systems_hsn,0 45 2 cell_number = 4 0 4 6 9 106 1311 chg_element hopping_systems_hsn,1 38 2 cell_number = 4 0 4 6 9 106 1311 chg_hop_params cell_number = 4 0 4 6 9 106 1311 0 1 1 80 82 119 45 chg_hop_params cell_number = 4 0 4 6 9 106 1311 1 1 1 869 873 38 4 0 4 6 9 106 1311 1 1 4 4 0 4 6 9 106 1312 2 1 4 Output should be: 4 0 4 6 9 106 1311 2Ah 69 82 45 38 4 0 4 6 9 106 1312 3Ah 77 These 45 and 38 can be taken from any line which is given in red in above input file,on basis of hopping system or cell number Really your help is appreciated...... Also plz expl me the logic behind the code to learn.... |
|
||||
|
Quote:
Considering the same input as before: InputFile: Code:
add_cell 4 0 4 6 9 106 1311 2 frequency_type = 1 bsic = 2Ah wait_indication_parameters = 10 ccch_conf = 0 add_cell 4 0 4 6 9 106 1312 2 frequency_type = 1 bsic = 3Ah wait_indication_parameters = 10 ccch_conf = 0 equip 1 RTF FULL BCCH 0 0 0 4 0 4 6 9 106 1311 69 255 255 255 255 255 255 255 255 equip 1 RTF FULL BCCH 1 0 0 4 0 4 6 9 106 1312 77 255 255 255 255 255 255 255 255 equip 1 RTF FULL NON_BCCH 0 2 0 4 0 4 6 9 106 1311 82 0 0 0 0 0 0 0 0 chg_element hopping_systems_enabled,0 1 2 cell_number = 4 0 4 6 9 106 1312 chg_element hopping_systems_enabled,1 1 2 cell_number = 4 0 4 6 9 106 1312 chg_element hopping_systems_hsn,0 45 2 cell_number = 4 0 4 6 9 106 1311 chg_element hopping_systems_hsn,1 38 2 cell_number = 4 0 4 6 9 106 1311 chg_hop_params cell_number = 4 0 4 6 9 106 1311 0 1 1 82 119 45 chg_hop_params cell_number = 4 0 4 6 9 106 1311 1 1 1 869 873 38 4 0 4 6 9 106 1311 1 1 4 4 0 4 6 9 106 1312 2 1 4 Output should be: 4 0 4 6 9 106 1311-2Ah-69-82 119-45-868 867-38 4 0 4 6 9 106 1312-3Ah-77 Just to explain if too confusing... < 4 0 4 6 9 106 1311> -- Cell Number our Unique key <2Ah> -- BSIC <69> --(Next string after the Key if 4th line from this would be BCCH) <82 119> --4th Line of Chg_hop_params <45> --5th Line of Chg_hop_params Let me know if its going above head.... Looking forward for your help Last edited by vgersh99; 07-08-2009 at 08:14 AM.. |
| Bits Awarded / Charged to shaliniyadav for this Post | |||
| Date | User | Comment | Amount |
| 07-08-2009 | vgersh99 | added code tags - charged 10K bits | -10,000 |
|
|||||
|
Quote:
Also, what changes have you tried yourself? We're on the THIRD page of this thread - you should be able make some minor modifications to the code. |
|
||||
|
Quote:
Output would be: Output should be: 4 0 4 6 9 106 1311-2Ah-69-82 119-45-869 873-38 4 0 4 6 9 106 1312-3Ah-77 are from the below lines in the input: chg_hop_params cell_number = 4 0 4 6 9 106 1311 0 1 1 82 119 45 chg_hop_params cell_number = 4 0 4 6 9 106 1311 1 1 1 869 873 38 |
|
|||||
|
something to start with - good luck! Code:
BEGIN {
SEPdash="-"
}
acell&&acell-- {
if (!acell) bsic[idx]=$NF
}
ahop&&ahop-- {
if (ahop==1) hopv=$NF
if (!ahop) a[idx]=(idx in a)?a[idx] OFS hopv SEPdash $0:hopv SEPdash $0
}
c&&c-- {
if (c) v=$0
else {
if (NF>1) a[idx]=(idx in a)?a[idx] SEPdash v:v
next
}
}
$1=="add_cell" {
acell=2;
idx=""
for(i=2;i<NF;i++) idx=(idx)? idx OFS $i : $i
idxA[idx]
}
$1 == "chg_hop_params" {
split($0, hopA, " = ")
idx=hopA[2]
ahop=5
next
}
$0 in idxA { c=2 ;idx=$0;v=""}
END {
for (i in idxA)
print i SEPdash bsic[i] SEPdash a[i]
}
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|