![]() |
Hallo und herzlich Willkommen aus den Vereinigten Staaten, die UNIX-und Linux-Foren! Vielen Dank für Ihren Besuch und die Teilnahme an unserem Global Community.
|
|
Google unix.com
|
|||||||
| Foren | Registrieren | Forum-Regeln | Links | Alben | FAQ | Benutzerliste | Kalender | Suche | Die heutige Beiträge | Alle Foren als gelesen markieren |
| UNIX für Fortgeschrittene und Experten Expert-to-Experte. Erfahren Sie fortgeschrittene UNIX-, UNIX-Kommandos, Linux-Betriebssysteme, System-Administration, Programmierung, Shell, Shell-Skripte, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
Mehr UNIX-und Linux-Forum Themen Vielleicht finden Sie hilfreiche
|
||||
| Faden | Thread Starter | Forum | Antworten | Last Post |
| Hinzufügen eines Blocks in der Datei | ROOZ | Shell Programmierung und Scripting | 4 | 08-20-2008 04:34 PM |
| Um die, wie ein Block von Daten aus der Datei | aoussenko | Shell Programmierung und Scripting | 4 | 06-26-2008 11:03 AM |
| Löschen von Text-Block in der Datei | andre123 | Shell Programmierung und Scripting | 1 | 02-27-2007 01:17 PM |
| Wählen Sie die letzte Block aus einer Datei | misenkiser | Shell Programmierung und Scripting | 9 | 10-11-2006 09:32 AM |
| Auszug Block in der Datei | sskb | UNIX for Dummies Questions & Answers | 5 | 10-25-2001 10:29 AM |
![]() |
|
|
LinkBack | Thread Tools | Suche diesen Thread | Rate Thread | Anzeige-Modi |
|
|
|
||||
|
Hilfe, um den Block aus einer Datei
Code:
<Connection^M
companyId="TCS"^M
connectionMode="client"^M
name="TCS_TEMP"^M
protocolVersion="4.2"^M
disableLogging="false"^M
</Connection>
<Connection^M
companyId="HCL"^M
connectionMode="client"^M
name="HCL_RSDC02"^M
protocolVersion="4.2"^M
disableLogging="false"^M
</Connection>
<Connection^M
companyId="SCB"^M
connectionMode="server"^M
name="SCB_ERSDC02"^M
protocolVersion="4.1"^M
disableLogging="false"^M
connectionIntervals="08:00:00,18:00:00"^M
connectAtStartup="true"^M
</Connection>
<Connection^M
companyId="SAT"^M
connectionMode="client"^M
name="SAT_RSDC02"^M
protocolVersion="4.0"^M
disableLogging="false"^M
</Connection>
Alle Befehle ...? Code:
output should be
<Connection^M
companyId="SCB"^M
connectionMode="server"^M
name="SCB_ERSDC02"^M
protocolVersion="4.1"^M
disableLogging="false"^M
connectionIntervals="08:00:00,18:00:00"^M
connectAtStartup="true"^M
</Connection>
|
|
||||
|
Speichern Sie dieses Skript, machen es ausführbar mit chmod:
Code:
#!bin/sh
awk -v var="$1" '
/<Connection/{i=0}
{a[++i]=$0}
$0 ~ var {f=1}
/<\/Connection>/ && f {for(j=1;j<=i;j++){print a[j]};exit}
' file
Code:
./scriptname SCB_ERSDC02 |
![]() |
| Lesezeichen |
| Thread Tools | Suche diesen Thread |
| Anzeige-Modi | Rate this thread |
|
|