Zitat von
undefined
und - wo liegt das problem ?
mal davon abgehen das ich bei so einem eingriff 100% mit backups arbeiten würde
Code:
cat /etc/fstab | awk ........ > /etc/fstab
Da bekommst du aber nur eine leere Datei zurück.
Code:
[florian@leuchtturm1 tmp]$ cat lines
Hallo
Welt
Zeile1
Zeile2
Zeile3
Zeile4
Zeile5
[florian@leuchtturm1 tmp]$ cat lines|awk '{print $0}'>lines
[florian@leuchtturm1 tmp]$ cat lines
[florian@leuchtturm1 tmp]$
Man kann aber die Dateiumleitung in das awk-Programm einbauen (oder hast du das gemeint undefined?), dann funktioniert das ganze:
Code:
[florian@leuchtturm1 tmp]$ cat test_file
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/hda1 / ext3 errors=remount-ro 0 1
/dev/hda3 /home ext3 defaults 0 0
/dev/hda2 none swap sw 0 0
/dev/hde /media/cdrom0 udf,iso9660 user,noauto 0 0
[florian@leuchtturm1 tmp]$ awk '/cdrom/ { $3 = "cdrom\t" ; print >"test_file" } !/cdrom/ { print >"test_file"} ' FS='/' OFS='/' test_file
[florian@leuchtturm1 tmp]$ cat test_file
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/hda1 / ext3 errors=remount-ro 0 1
/dev/hda3 /home ext3 defaults 0 0
/dev/hda2 none swap sw 0 0
/dev/cdrom /media/cdrom0 udf,iso9660 user,noauto 0 0
Gruß, Florian
Lesezeichen