Suchen und Ersetzen mit AWK


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Suchen und Ersetzen mit AWK
Prev   Next
# 1  
Old 05-18-2010
Suchen und Ersetzen mit AWK

Hallo,

ich habe mir mit meinen dürftigen Programmierkenntnissen ein Script zusammengebastelt über das ich in einem bestimmten Odner mit AWK alle Dateien eines Verzeichnis durchsuche und bestimmte Bezeichungen aller Dateien ändern kann.
Es funktioniert auch soweit, nur hätte ich gerne auch die Information wo was geändert wurde. Entweder in Form einer Berichtausgabe oder eines Logfiles o.ä.


#!/bin/bash
DATMASKE='*.cfg'
read serveralt
read serverneu
echo Bisherige Bezeichnung: $serveralt , neue Bezeichung: $serverneu

for x in $(find /home/test -type f -iname "$DATMASKE"); do
awk ' { gsub("'$serveralt'","'$serverneu'"); print > FILENAME } ' $x

done


Kann mir wer weiterhelfen. bin über Google nicht wirklich weitergekommen.

Vielen Dank
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. What is on Your Mind?

EdX - Founded by Harvard University and MIT in 2012

Is anyone actively learning, auditing or participating (for credit) at edX? There are some really great science and engineering programs there and they are all free to audit. For example, take a look at these classes related to: C Programming Quantum Physics Computer Science ... (6 Replies)
Discussion started by: Neo
6 Replies

2. UNIX for Dummies Questions & Answers

Read workstation list from file und run command

Hi, how do I read in a file which includes a list of workstations and then run a command for each workstation ? I am unclear which command to use to read in , or is this not possible ? Thanks, (3 Replies)
Discussion started by: manni2
3 Replies

3. Solaris

rdesktop zugriff auf W2K8R2 Farm mit NLB und Session Broke - server sent an unexpectedly long string

Hallo :-) Ich habe da ein Problem beim Zugriff von Solaris mittels rdesktop auf eine TS Farm unter W2K8R2 mit NLB und Session Broker. Ich bekomme folgende Fehlermeldung: user@sunray2xxx /h/user/Desktop 150 > rdesktop terminalserver WARNING: Remote desktop does not support colour... (1 Reply)
Discussion started by: chrischi1978
1 Replies

4. Shell Programming and Scripting

Script mit Laufvariable schlanker gestalten?

Hiho. Ich habe mit meinen rudimentären Scriptkenntnissen folgendes nicht sehr elegantes Script geschrieben und würde es gern in einer etwas eleganteren Form haben. i=0 ... (2 Replies)
Discussion started by: Lock3
2 Replies

5. Shell Programming and Scripting

Script mit Laufvariable schlanker gestalten?

Hiho. Ich habe mit meinen rudimentären Scriptkenntnissen folgendes nicht sehr elegantes Script geschrieben und würde es gern in einer etwas eleganteren Form haben. i=0 ... (2 Replies)
Discussion started by: Lock3
2 Replies

6. Shell Programming and Scripting

Backup eines Verzeichnis und der unterverzeichnisse erstellen

Hallo ich bin neu in dem bereich Bash scripting und deswegen suche ich ein script der auf meinem unix server laufen soll und zwar immer wenn ich den server starte oder alle 24h der script soll ein backup von einem verzeichnis und meheren unterverzeichnissen erstellen da ich nirgends was... (1 Reply)
Discussion started by: HansWurst
1 Replies

7. Shell Programming and Scripting

shell script vorher batch mit curl

salve! this in windows command script (batch). i need it for mac....unix or linux @echo off Echo Router reconnect: AVM FRITZ!BOX FON WLAN 7170 curl "http://192.168.10.10:49000/upnp/control/WANIPConn1" -H "Content-Type: text/xml; charset="utf-8"" -H... (1 Reply)
Discussion started by: onkeldave
1 Replies

8. Shell Programming and Scripting

Bash: Zeilen aus Datei mit cat und grep in dynamisches Array schreiben

Hallo, ich habe eine Datei "Kino.ini" die z.B. wie folgt aussieht * KINOFILM A bla bla KINOFILM B blubb blubb KINOFILM C Ich möchte nun die Datei "Kino.ini" per cat und grep auslesen und testen ob der String KINOFILM nur mit einem '*' am Anfang vorkommt. In dieser Beispieldatei... (3 Replies)
Discussion started by: ABE2202
3 Replies

9. UNIX for Dummies Questions & Answers

Shell-Script und Pipes

Hi, beginne gerade mich in der UNIX Welt zu recht zu finden : habe nun folgendes Anliegen, hoffe ihr könnt mir helfen (ist sicher trival für euch, sorry dafür -) ) Ich möchte mir ein kleines Shell-Script schreiben , welches mir dateien eines bestimmten verzeichnisses anhand der Anzahl der... (4 Replies)
Discussion started by: anja_22
4 Replies

10. UNIX for Dummies Questions & Answers

Xlib: Invalid MIT-MAGIC-COOKIE-1

Anyone: I have a very annoying problem on one of our servers (running Solaris 8). when ever I try to run "xhost +" with the display set at "localhost:0.0" I get the following error: xhost + Xlib: connection to "finappprod:0.0" refused by server Xlib: Invalid... (1 Reply)
Discussion started by: errolg
1 Replies
Login or Register to Ask a Question
IGAWK(1)							 Utility Commands							  IGAWK(1)

NAME
igawk - gawk with include files SYNOPSIS
igawk [ all gawk options ] -f program-file [ -- ] file ... igawk [ all gawk options ] [ -- ] program-text file ... DESCRIPTION
Igawk is a simple shell script that adds the ability to have ``include files'' to gawk(1). AWK programs for igawk are the same as for gawk, except that, in addition, you may have lines like @include getopt.awk in your program to include the file getopt.awk from either the current directory or one of the other directories in the search path. OPTIONS
See gawk(1) for a full description of the AWK language and the options that gawk supports. EXAMPLES
cat << EOF > test.awk @include getopt.awk BEGIN { while (getopt(ARGC, ARGV, "am:q") != -1) ... } EOF igawk -f test.awk SEE ALSO
gawk(1) Effective AWK Programming, Edition 1.0, published by the Free Software Foundation, 1995. AUTHOR
Arnold Robbins (arnold@skeeve.com). Free Software Foundation Nov 3 1999 IGAWK(1)