Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Shell Prozedur soll group + passwd Datei auslesen

Empfohlene Antworten

Veröffentlicht

Hallo! :confused:

Ich möchte eine Shellprozedur schreiben, der die Dateien group und passwd ausliest und mir nur die benötigten Einträge in eine Datei schreibt.

Also z.b. von group soll er nur die erste und vorletzte Eintrag in Zeile rausschreiben.

Von:

# $FreeBSD: src/etc/group,v 1.19 1999/08/27 23:23:41 peter Exp $

#

wheel:*:0:root

daemon:*:1:daemon

kmem:*:2:root

sys:*:3:root

tty:*:4:root

Zu:

wheel 0

daemon 1

kmem 2

sys 3

tty 4

Eine Schleife muss gemacht werden, der dann jede Zeile einzeln liest. Wie trenne ich das?

Danke für eure hilfe

Originally posted by first_unix_nutzer

Hallo! :confused:

Ich möchte eine Shellprozedur schreiben, der die Dateien group und passwd ausliest und mir nur die benötigten Einträge in eine Datei schreibt.

Also z.b. von group soll er nur die erste und vorletzte Eintrag in Zeile rausschreiben.

Von:

# $FreeBSD: src/etc/group,v 1.19 1999/08/27 23:23:41 peter Exp $

#

wheel:*:0:root

daemon:*:1:daemon

kmem:*:2:root

sys:*:3:root

tty:*:4:root

Zu:

wheel 0

daemon 1

kmem 2

sys 3

tty 4

Eine Schleife muss gemacht werden, der dann jede Zeile einzeln liest. Wie trenne ich das?

Danke für eure hilfe

Wie du die Schleife machst, findest du hier

http://www.fachinformatiker-world.de/forums/showthread.php?s=&threadid=24157&highlight=zeilenweise

Den Rest machst mit awk

Beispiel für die /etc/group

#!/bin/bash

FILE="/out.txt"

SIZE=`cat -n $FILE | tail -1`

echo $SIZE | awk -F: ' { print $1 $3 } '

n=1

while [[ $n -le "$SIZE" ]]

do

head -$n $FILE | tail -1

n=$(($n+1))

done

Sumpfbiber

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.