Extraire des lignes dans un fichier

Résolu/Fermé
GHISLINO Messages postés 214 Date d'inscription lundi 25 juillet 2011 Statut Membre Dernière intervention 8 décembre 2023 - 16 déc. 2014 à 20:26
dubcek Messages postés 18755 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 14 novembre 2024 - 19 déc. 2014 à 10:25
Bonjour,


Bonsoir a tous

j'ai un fichier File1 se presantant comme l'exemple ci-dessous






**********************

* CONFIGURATION INFO *

**********************

Site Name: MPR_FRANQUEVILLE_4

Site Location: FRANQUEVILLE



QUALITY OF SERVICE CONFIGURATION

================================



Classification Criterion: IEEE 802.1p



Scheduler Configuration

-----------------------

Queue Mode Weight

5 DWRR 16

4 DWRR 8

3 DWRR 4

2 DWRR 2

1 DWRR 1





IEEE 802.1p -> Forwarding Class Mapping

---------------------------------------

Forwarding Class 7: No PCP associated

Forwarding Class 6: No PCP associated

Forwarding Class 5: No PCP associated

Forwarding Class 4: PCP 7

Forwarding Class 3: PCP 6

Forwarding Class 2: PCP 4,5

Forwarding Class 1: PCP 2,3

Forwarding Class 0: PCP 0,1









Tributaries Impedance: Balanced 120 Ohm





Current SNMP Version: V2


IP STACK VERSION: IPv4







Fans: equipped



Admission Control for Adaptive Modulation (ODU300 only): Disabled



System Priority: 0







TRUSTED MANAGERS

================

None





CORE CONFIGURATION

==================

Type: MSS-8, Enhanced, Protected







ETHERNET PORT

-------------



** Ep 1 **



Status: Disabled




Ethernet Label:



** Ep 2 **



Status: Disabled




Ethernet Label:



** Ep 3 **



Status: Enabled

Auto Negotiation: Enabled

BitRate:

1000 Full Duplex

Flow Control: Disable

Port in LAG: false

Synch Mode: Synchronous

Synch Role: Master



SSM STATUS: Disabled



Acceptable Frame Type: Admit only tagged


Ethernet Rate Limit: Not Enabled


Ethernet Storm Controller: Not Enabled


Vlan Ethernet Rate Limiter: Disabled


Vlan Swap Feature: Disabled


Per-VLAN Per-CoS Ethernet Rate Limiter: Disabled




Ethernet Label: MPR5_s1p3



** Ep 4 **



Transport mode

Status: Enabled

Auto Negotiation: Enabled

BitRate:

1000 Full Duplex

Flow Control: Disable

Port in LAG: false

Synch Mode: Synchronous

Synch Role: Slave



SSM STATUS: Disabled



Acceptable Frame Type: Admit only tagged


Ethernet Rate Limit: Not Enabled


Ethernet Storm Controller: Not Enabled


Vlan Ethernet Rate Limiter: Disabled


Vlan Swap Feature: Disabled


Per-VLAN Per-CoS Ethernet Rate Limiter: Disabled




Ethernet Label: MPR1_s1p4



** Ep 5: Optical **



SFP: Not Equipped



** Ep 6: Optical **



SFP: Not Equipped







LAGS CONFIGURATION

==================

None







SLOTS CONFIGURATION

===================



** Slot 3 - slot 4 HSB Protected MD300 **



Preset Capabilities Index: 8



Preset Mode:

Capacity: 85.638 Mb/s

Modulation: 16 QAM

Channel Spacing: 28 MHz

Profile Option: standard





EPS: Revertive

RPS: Revertive

TPS: Revertive



LINK IDENTIFIER:

Status: Enabled

Expected Value: 0

Transmitted Value: 0



TMN RF MANAGEMENT:

Status: Enabled

OSPF Routing Area Number: 1



Shifter: 490000

Tx Frequency: 14991000



Channel 1:

ATPC: Disabled

Tx Power: 18.0 dBm



Channel 0:

ATPC: Disabled

Tx Power: 18.0 dBm



SSM STATUS: Disabled



QUEUE SIZES:

Queue 1: 1140800 bytes (default value)

Queue 2: 1140800 bytes (default value)

Queue 3: 1140800 bytes (default value)

Queue 4: 1140800 bytes (default value)

Queue 5: 1140800 bytes (default value)



RADIO LABEL: NGODI_1



** Slot 5 - slot 6 HSB Protected MD300 **



Preset Capabilities Index: 5



Preset Mode:

Capacity: 42.118 Mb/s

Modulation: 16 QAM

Channel Spacing: 14 MHz

Profile Option: standard





EPS: Revertive

RPS: Revertive

TPS: Revertive



LINK IDENTIFIER:

Status: Disabled



TMN RF MANAGEMENT:

Status: Enabled

OSPF Routing Area Number: 1



Shifter: 490000

Tx Frequency: 15110000



Channel 1:

ATPC: Disabled

Tx Power: 18.0 dBm



Channel 0:

ATPC: Disabled

Tx Power: 18.0 dBm



SSM STATUS: Disabled



QUEUE SIZES:

Queue 1: 562836 bytes (default value)

Queue 2: 562836 bytes (default value)

Queue 3: 562836 bytes (default value)

Queue 4: 562836 bytes (default value)

Queue 5: 562836 bytes (default value)



RADIO LABEL: AKWA-PALACE_1



** Slot 7 Unprotect Pdh **

Node Timing: Disabled

E1 Tributary 1: Unframed Label:

Flow Id: 102

Service Profile: TDM2TDM

E1 Tributary 2: Unframed Label:

Flow Id: 103

Service Profile: TDM2TDM

E1 Tributary 3: Unframed Label:

Flow Id: 104

Service Profile: TDM2TDM

E1 Tributary 4: Unframed Label:

Flow Id: 105

Service Profile: TDM2TDM

E1 Tributary 5: Unframed Label:

Flow Id: 106

Service Profile: TDM2TDM

E1 Tributary 6: Unframed Label:

Flow Id: 107

Service Profile: TDM2TDM

E1 Tributary 7: Unframed Label:

Flow Id: 2

Service Profile: TDM2TDM

E1 Tributary 8: Unframed Label:

Flow Id: 3

Service Profile: TDM2TDM

E1 Tributary 9: Unframed Label:

Flow Id: 4

Service Profile: TDM2TDM

E1 Tributary 10: Unframed Label:

Flow Id: 110

Service Profile: TDM2TDM

E1 Tributary 11: Unframed Label:

Flow Id: 79

Service Profile: TDM2TDM

E1 Tributary 12: Unframed Label:

Flow Id: 101

Service Profile: TDM2TDM

E1 Tributary 13: Unframed Label:

Flow Id: 67

Service Profile: TDM2TDM

E1 Tributary 14: Unframed Label:

Flow Id: 68

Service Profile: TDM2TDM

E1 Tributary 15: Unframed Label:

Flow Id: 80

Service Profile: TDM2TDM

E1 Tributary 16: Unframed Label:

Flow Id: 81

Service Profile: TDM2TDM

E1 Tributary 17: Disabled Label:

E1 Tributary 18: Disabled Label:

E1 Tributary 19: Disabled Label:

E1 Tributary 20: Disabled Label:

E1 Tributary 21: Disabled Label:

E1 Tributary 22: Disabled Label:

E1 Tributary 23: Disabled Label:

E1 Tributary 24: Disabled Label:

E1 Tributary 25: Disabled Label:

E1 Tributary 26: Disabled Label:

E1 Tributary 27: Disabled Label:

E1 Tributary 28: Disabled Label:

E1 Tributary 29: Disabled Label:

E1 Tributary 30: Disabled Label:

E1 Tributary 31: Disabled Label:

E1 Tributary 32: Disabled Label:



** Slot 8 MPT-ACC **



Power Source 1 Type: PoE



Power Source 2 Type: PoE



Port: 8.1 - MPT Not Protected



MPT TYPE: MPT-MC



LINK IDENTIFIER:

Status: Disabled



TMN RF MANAGEMENT:

Status: Enabled

OSPF Routing: Area Number: 1



Preset Mode:

Channel Spacing: 14 MHz

Modulation: 16 QAM

Capacity: 42.151 Mb/s

ETSI Mask: stdCurrent



Channel 1:

Shifter : 490000

TX Frequency : 14501000

Min TX Freq. : 14400000

Max TX Freq. : 14635000

RX Frequency : 14991000

------ Preset Mode ------

ATPC: Enabled

Min TX Power : 1.0 dBm

Max TX Power : 23.0 dBm

RX Treshold : -55.0 dBm



SSM STATUS: Disabled



PKT THROUGHPUT BOOSTER STATUS: Disabled



QUEUE SIZES:

Queue 1: 1568228 bytes (default value)

Queue 2: 1568228 bytes (default value)

Queue 3: 1568228 bytes (default value)

Queue 4: 1568228 bytes (default value)

Queue 5: 1568228 bytes (default value)



RADIO LABEL: ACTIVA-AKWA_1



MPT in LAG: false



XPIC Polarization: Disabled



Port: 8.2 - MPT Not Protected



MPT TYPE: MPT-MC



LINK IDENTIFIER:

Status: Disabled



TMN RF MANAGEMENT:

Status: Enabled

OSPF Routing: Area Number: 1



Preset Mode:

Channel Spacing: 14 MHz

Modulation: Q PSK

Capacity: 20.445 Mb/s

ETSI Mask: stdCurrent



Channel 1:

Shifter : 119000

TX Frequency : 8335000

Min TX Freq. : 8328000

Max TX Freq. : 8370000

RX Frequency : 8454000

------ Preset Mode ------

ATPC: Enabled

Min TX Power : 1.0 dBm

Max TX Power : 25.0 dBm

RX Treshold : -55.0 dBm



SSM STATUS: Disabled



PKT THROUGHPUT BOOSTER STATUS: Disabled



QUEUE SIZES:

Queue 1: 754168 bytes (default value)

Queue 2: 754168 bytes (default value)

Queue 3: 754168 bytes (default value)

Queue 4: 754168 bytes (default value)

Queue 5: 754168 bytes (default value)



RADIO LABEL: SGBC Bonanjo



MPT in LAG: false



XPIC Polarization: Disabled



Port: 8.3 - Empty

Port: 8.4 - Empty







XPIC ASSOCIATION INTERFACE

==========================

NONE









OSPF AREAS

==========

Ospf Area 0:

IP Address: 0.0.0.0

Stub Flag: FALSE

Ospf Area 1:

IP Address: 0.0.4.0

Stub Flag: FALSE









NTP Configuration

=================

Status: Enabled

Main Server: 1xxx.xx.xx.1xx

Spare Server: 1xx.xx.1xx.xxx









DHCP Configuration

==================

Status: Enabled









TMN ETHERNET INTERFACE

======================

Local Ip Address: 17x.xx.xxx.xx




TMN Ethernet:

Status: Enabled

ipAddress: 10.x.xx.xx

netMask: 255.255.xxx.xxx

OSPF Routing, area number: 1







TMN INBAND PROFILES

===================


TMN InBand Profile: 1

Status: Disabled

ipAddress: 10.x.x.x

netMask: 255.255.255.0

vLanId:

Static Routing

Ethernet Member Ports:


TMN InBand Profile: 2

Status: Enabled

ipAddress: 1xx.xx.xx.xx

netMask: 255.255.xx.xxx

vLanId: 450

OSPF Routing, area number: 1

Ethernet Member Ports:

Ethernet Port: 3

Ethernet Port: 4







STATIC ROUTES

=============







CROSS CONNECTIONS

=================





E1-Radio Connections

--------------------

* E1* PDH(7) - Radio(81): flowID: 102

* E1* PDH(7) - Radio(3): flowID: 103

* E1* PDH(7) - Radio(3): flowID: 104

* E1* PDH(7) - Radio(3): flowID: 105

* E1* PDH(7) - Radio(5): flowID: 106

* E1* PDH(7) - Radio(5): flowID: 107

* E1* PDH(7) - Radio(5): flowID: 2

* E1* PDH(7) - Radio(5): flowID: 3

* E1* PDH(7) - Radio(5): flowID: 4

* E1* PDH(7) - Radio(5): flowID: 110

* E1* PDH(7) - Radio(5): flowID: 79

* E1* PDH(7) - Radio(81): flowID: 101

* E1* PDH(7) - Radio(5): flowID: 67

* E1* PDH(7) - Radio(5): flowID: 68

* E1* PDH(7) - Radio(3): flowID: 80

* E1* PDH(7) - Radio(3): flowID: 81





DS1-Radio Connections

---------------------





DS3-Radio Connections

---------------------





E1-Ethernet Connections

-----------------------





DS1-Ethernet Connections

------------------------





DS3-Ethernet Connections

------------------------





Radio-Radio Connections

-----------------------





Radio-Ethernet Connections

--------------------------





STM-1 transparent-Radio Connections

-----------------------------------





E1-SDHCHAN Connections

----------------------





SDHCHAN-Radio Connections

-------------------------





SDHCHAN-Ethernet Connections

----------------------------





STM-1 transparent-Ethernet Connections

--------------------------------------







RING

====



None







BRIDGE

======

Type: 802.1Q





VLAN

----

- Vlan ID: 1 Vlan Name: "Default Vlan"

- All Ports are Members untagged

- Vlan ID: 72 Vlan Name: "ECO-BANK_DATA-CENTER"

- CORE Ethernet Port 4 tagged

- MD300 Radio Slot 5 tagged

- Vlan ID: 111 Vlan Name: "First Trust DC"

- CORE Ethernet Port 3 tagged

- CORE Ethernet Port 4 tagged

- Vlan ID: 401 Vlan Name: "ADM CACAO"

- CORE Ethernet Port 3 tagged

- CORE Ethernet Port 4 tagged

- Vlan ID: 433 Vlan Name: "INTERCO_CIBLE_RH_DC"

- CORE Ethernet Port 4 tagged

- MD300 Radio Slot 5 tagged

- Vlan ID: 435 Vlan Name: "INTERNET_CIBLE_RH_DC"

- CORE Ethernet Port 4 tagged

- MD300 Radio Slot 5 tagged

- Vlan ID: 441 Vlan Name: "Internet Total Cameroun"

- CORE Ethernet Port 3 tagged

- CORE Ethernet Port 4 tagged

- Vlan ID: 448 Vlan Name: "APN SGBC"

- CORE Ethernet Port 4 tagged

- MPT-MC Radio on MPT-ACC Slot 8 Port 2 tagged







SEGREGATED PORTS

----------------

No segregated ports





SYNCHRONIZATION

===============



Synchronization Role: Master

Restoration Mode: Revertive



Primary Source: Eth Port#04

Secondary Source: Free Run Local Oscillator



External Signal: DISABLED





SSM Wait To Restore: 5 min 0 sec





SOFTWARE PACKAGE STATUS

=======================



Name: R95M

Version: V04.02.0L

Operational Status: Enabled

Current Status: Committed

Software Unit: Label Version Size

----- --------- --------

BOMPT V05.01.01 492956

FGUIN V03.12.00 3042352

FGUIH V05.03.00 3068602

MDPAR V04.01.03 365924

FDUFF V02.03.04 1756544

FALCI V01.01.01 4928127

OC_R V04.06.10 74368

FCERE V01.02.05 401616

FDUJU V02.05.09 1899669

FMPVG V03.05.50 92764

SWMPT V09.05.02 8958974

FADAM V01.09.51 661355

FADMX V01.09.51 796411

FMSS1 V00.04.22 603063

PAMPT V03.00.21 178165

PAMM1 V03.00.09 98970

FDDSC V04.02.00 2280

FFURO V02.01.08 524288

FRCFG V00.00.05 31800

FCNFD V00.00.59 283776

FASAP V01.03.03 2049145

FCERA V01.07.00 529772

FDOSX V01.01.01 90197

FMOLI V02.01.07 3477932

FHAIB V01.01.03 4141870

FSHIN V01.09.02 2097152

FMSDH V00.15.26 1083393

HLELF V04.02.12 4317735

HLCFG V03.11.02 46736

HLHWA V03.01.08 2102998

HLSWA V04.02.12 1491385

HLRFC V02.00.23 51898

EC V15.12.00 11796480





Name: R95M

Version: V04.02.0L

Operational Status: Enabled

Current Status: Standby

Software Unit: Label Version Size

----- --------- --------

BOMPT V05.01.01 492956

FGUIN V03.12.00 3042352

FGUIH V05.03.00 3068602

MDPAR V04.01.03 365924

FDUFF V02.03.04 1756544

FALCI V01.01.01 4928127

OC_R V04.06.10 74368

FCERE V01.02.05 401616

FDUJU V02.05.09 1899669

FMPVG V03.05.50 92764

SWMPT V09.05.02 8958974

FADAM V01.09.51 661355

FADMX V01.09.51 796411

FMSS1 V00.04.22 603063

PAMPT V03.00.21 178165

PAMM1 V03.00.09 98970

FDDSC V04.02.00 2280

FFURO V02.01.08 524288

FRCFG V00.00.05 31800

FCNFD V00.00.59 283776

FASAP V01.03.03 2049145

FCERA V01.07.00 529772

FDOSX V01.01.01 90197

FMOLI V02.01.07 3477932

FHAIB V01.01.03 4141870

FSHIN V01.09.02 2097152

FMSDH V00.15.26 1083393

HLELF V04.02.12 4317735

HLCFG V03.11.02 46736

HLHWA V03.01.08 2102998

HLSWA V04.02.12 1491385

HLRFC V02.00.23 51898

EC V15.12.00 11796480





SECURE SETTINGS

===============



|===================|

| Protocol | Status |

|-------------------|

| FTP | ON |

|-------------------|

| Telnet | ON |

|-------------------|

| SSH | ON |

|-------------------|

| SFTP | ON |

|-------------------|

| HTTP | ON |

|===================|













*****************************

* END OF CONFIGURATION INFO *

*****************************




dans ce fichier j'ai besoin extrait les infos ci-dessous

Site Name: MPR_FRANQUEVILLE_4
** Slot 3 - slot 4 HSB Protected MD300 **
Capacity: 85.638 Mb/s
Tx Frequency: 14991000
RADIO LABEL: NGODI_1
Local Ip Address: 17x.xx.xxx.xx

Tout en sachant que la config du RADIO LABEL: NGODI_1 needed correspond au info qui le precede.

et le reorganiser dans un fichier comme ci-dessous


Local Ip Address: 17x.xx.xxx.xx,MPR_FRANQUEVILLE_4;NGODI_1;Slot 3 - slot 4 HSB Protected MD300;Capacity: 85.638 Mb/s;Tx Frequency: 14991000
Local Ip Address: 17x.xx.xxx.xx;MPR_FRANQUEVILLE_4;AKWA-PALACE_1;Slot 5 - slot 6 HSB Protected MD300;Capacity: 42.118 Mb/s;Tx Frequency: 15110000


Merci d'avance





A voir également:

7 réponses

dubcek Messages postés 18755 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 14 novembre 2024 5 621
17 déc. 2014 à 10:56
hello
$ LIP=$(grep "Local Ip" fichier)
$ awk -v l="${LIP}" '{sub("^[ \t]*", "")} /Site Name/ {n=$3} /\*\* Slot/ {gsub("[*]*", ""); s=$0} /Capacity/ {c=$0} /Tx Frequency/ {f=$0} /RADIO LABEL/ {r=$3; print l "," n "," r "," s "," c "," f}' fichier
Local Ip Address: 17x.xx.xxx.xx,MPR_FRANQUEVILLE_4,NGODI_1, Slot 3 - slot 4 HSB Protected MD300 ,Capacity: 85.638 Mb/s,Tx Frequency: 14991000
Local Ip Address: 17x.xx.xxx.xx,MPR_FRANQUEVILLE_4,AKWA-PALACE_1, Slot 5 - slot 6 HSB Protected MD300 ,Capacity: 42.118 Mb/s,Tx Frequency: 15110000
Local Ip Address: 17x.xx.xxx.xx,MPR_FRANQUEVILLE_4,ACTIVA-AKWA_1, Slot 8 MPT-ACC ,Capacity: 42.151 Mb/s,Tx Frequency: 15110000
Local Ip Address: 17x.xx.xxx.xx,MPR_FRANQUEVILLE_4,SGBC, Slot 8 MPT-ACC ,Capacity: 20.445 Mb/s,Tx Frequency: 15110000
0
dubcek Messages postés 18755 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 14 novembre 2024 5 621
Modifié par dubcek le 17/12/2014 à 13:09
supprime les espaces
$ awk -v l="${LIP}" '{sub("^[ \t]*", "")} /Site Name/ {n=$3} /\*\* Slot/ {gsub("[*][*] | [*][*]", ""); s=$0} /Capacity/ {c=$0} /Tx Frequency/ {f=$0} /RADIO LABEL/ {r=$3; v=";"; print l v n v r v s v c v f}' fichier
Local Ip Address: 17x.xx.xxx.xx;MPR_FRANQUEVILLE_4;NGODI_1;Slot 3 - slot 4 HSB Protected MD300;Capacity: 85.638 Mb/s;Tx Frequency: 14991000
Local Ip Address: 17x.xx.xxx.xx;MPR_FRANQUEVILLE_4;AKWA-PALACE_1;Slot 5 - slot 6 HSB Protected MD300;Capacity: 42.118 Mb/s;Tx Frequency: 15110000
Local Ip Address: 17x.xx.xxx.xx;MPR_FRANQUEVILLE_4;ACTIVA-AKWA_1;Slot 8 MPT-ACC;Capacity: 42.151 Mb/s;Tx Frequency: 15110000
Local Ip Address: 17x.xx.xxx.xx;MPR_FRANQUEVILLE_4;SGBC;Slot 8 MPT-ACC;Capacity: 20.445 Mb/s;Tx Frequency: 15110000
0
GHISLINO Messages postés 214 Date d'inscription lundi 25 juillet 2011 Statut Membre Dernière intervention 8 décembre 2023
18 déc. 2014 à 09:54
Bonjour Dubcek

Merci pour ton retour ,

ci-dessous le test que j ai realise


 Administrateur@sweet-8696d5148 /cygdrive/f/MPR_CONFIG
$ LIP=$(grep "Local Ip" MPR_FRANQUEVILLE_4_modify.txt)

Administrateur@sweet-8696d5148 /cygdrive/f/MPR_CONFIG
$ awk -v l="${LIP}" '{sub("^[ \t]*", "")} /Site Name/ {n=$3} /\*\* Slot/ {gsub("[*]*", ""); s=$0} /Capacity/ {c=$0} /Tx Frequency/ {f=$0} /RADIO LABEL/ {r=$3; print l "," n "," r "," s "," c "," f}' MPR_FRANQUEVILLE_4_modify.txt
,Tx Frequency: 14991000 needed needed ,MPR_FRANQUEVILLE_4,NGODI_1, Slot 3 - slot 4 HSB Protected MD300 needed
,Tx Frequency: 15110000 otected MD300 neededANQUEVILLE_4,AKWA-PALACE_1
,Tx Frequency: 151100002.139.11 needed ,MPR_FRANQUEVILLE_4,ACTIVA-AKWA_1
,Tx Frequency: 151100002.139.11 needed ,MPR_FRANQUEVILLE_4,SGBC, Slot 8 MPT-ACC


il manque la variable LIP en sortie

et ne fonctionne seulement que pour le fichier que j ai posté : le probleme est que j'ai pres de mille fichiers de la sorte a traiter.

merci.
0
dubcek Messages postés 18755 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 14 novembre 2024 5 621
18 déc. 2014 à 10:47
je teste avec ton exemple, que retourne
grep -i "Local Ip" MPR_FRANQUEVILLE_4_modify.txt
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
GHISLINO Messages postés 214 Date d'inscription lundi 25 juillet 2011 Statut Membre Dernière intervention 8 décembre 2023
19 déc. 2014 à 08:43
bonjour dubcek

ci-dessous le resultat:

$ grep -i "Local Ip" MPR_FRANQUEVILLE_4_modify.txt
Local Ip Address: 17x.xx.xx.xx

0
dubcek Messages postés 18755 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 14 novembre 2024 5 621
19 déc. 2014 à 09:22
tu es sur Solaris, non ? essayer avec nawk
0
dubcek Messages postés 18755 Date d'inscription lundi 15 janvier 2007 Statut Contributeur Dernière intervention 14 novembre 2024 5 621
19 déc. 2014 à 10:25
ou essayer
awk '{...}' l="$LIP" fichier
0