
Hi zusammen! Es handelt sich um "parameter expansion" unter bash. Die Variable $string hat folgenden Wert, der beispielsweise durch `ls -l` erzeugt wird: string="-rw-r--r-- 1 root root 3375617 Oct 1 14:35 users.txt" Wie kann ich das Teil von "Oct 1 14:35 users.txt" heraus schneiden, wobei das übrige Teil weggeschmissen wird? Habe mit ${string#[^A-Z]*} und ähnlichen erfolglos probiert. Dank im voraus! peter

On Thursday 14 October 2004 10:45, Matthias Dort wrote:
Wenn es sich um die Ausgabe von ls handelt, und man spezielle Daten einer Datei wissen möchte, kann man das auch einfacher haben: stat - display file or filesystem status Jürgen -- Dr.rer.nat. Juergen Vollmer, Viktoriastrasse 15, D-76133 Karlsruhe Tel: +49(721) 9204871 Fax: +49(721) 24874 Juergen.Vollmer@informatik-vollmer.de www.informatik-vollmer.de Internet-Telefonie: www.skype.com Benutzer: juergen.vollmer

Am Donnerstag, 14. Oktober 2004 10:45 schrieb Matthias Dort:
Hallo Ich stehe vor einem Änlichem problem in der SuSE9.1 geht mein lt nicht mehr:
Das kommt bei der SuSE9.0 raus. lt -rw-r--r-- 1 root root 1.7K Sep 4 13:24 syslog -rw-r--r-- 1 root root 1.7K Sep 4 13:24 dhcpd drwxr-xr-x 2 root root 72 Sep 4 13:25 daemons -rw-r--r-- 1 root root 490 Sep 4 13:25 spamd drwxr-xr-x 6 root root 424 Sep 5 14:57 network -rw-r--r-- 1 root root 949 Sep 5 15:33 antivir -rw-r--r-- 1 root root 343 Sep 20 11:26 samba 62 Dateien, 122,935 KBytes Gruss Patrice

On Thu, Oct 14, 2004 at 10:45:59AM +0200, Matthias Dort wrote:
Mit bash-eigenen Mitteln ist das soviel ich weiß auch nicht hinzubekommen (lasse mich gern vom Gegenteil überzeugen ;-)). Eine Möglichkeit wäre z.B.: string=`echo $string|awk '{print substr($0,index($0,$6))}'` f -- Gravity is a myth, the Earth sucks.

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thursday 14 October 2004 12:33, Florian Tham wrote:
Vielleicht hilft das weiter: opi:/home/r2 # ls -l x* | while read c1 c2 c3 c4 c5 rest; do echo "$rest"; done Sep 22 15:10 x Oct 9 20:36 x.iso Sep 22 15:10 x.pl Sep 22 14:56 x.pl~ Sep 26 21:56 x2.pl Sep 26 21:49 x2.pl~ Also: opi:/home/r2 # string="$(ls -l x.pl)" opi:/home/r2 # echo "$string" - -rw-r--r-- 1 r2 users 384 Sep 22 15:10 x.pl opi:/home/r2 # string="$(echo "$string" | (read c1 c2 c3 c4 c5 rest; echo $rest))" opi:/home/r2 # echo "$string" Sep 22 15:10 x.pl Torsten -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFBbnYOwicyCTir8T4RAlAQAKCjg/5dUip0utvg4G9zrDvYNJgtDgCgoBUL RksQ9xKksb1flIUwOBZfZmE= =gdbg -----END PGP SIGNATURE-----

On Thu, 14 Oct 2004, Florian Tham wrote:
Danke Florian und Torsten! Eure professionellen Lösungen haben mich wirklich sehr begeistert. Übrigens, könnte ich ohne letzte Mail von Florian die HTML-Mail von Torsten nicht lesen. Schönen Freitag und schönes Wochenende! peter

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday 15 October 2004 09:47, Matthias Dort wrote:
Übrigens, könnte ich ohne letzte Mail von Florian die HTML-Mail von Torsten nicht lesen.
Hallo Matthias, ich habe mal die Mail, so wie ich sie von der Liste empfangen habe, angehängt. Ich sehe dort kein bischen HTML, der Content-Type Header sagt, es sei text/plain. Auch KMail meint, es sei KEINE HTML Mail. Ich habe keine Ahnung, woher Du eine HTML Mail bekamst, von mir jedenfalls nicht. Ich verschicke solche aus Prinzip nicht. Allerdings wird meine Mail Adresse von Spammern öfters missbraucht, leider. Daher sind Mails, die wirklich von mir kommen gewöhnlich gpg-signiert. Torsten -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFBb4TCwicyCTir8T4RAtj3AJ9Re4/cuWPHLqVzg6nL5a9XbyUtzACdHrLW MCGeHb+Tgx7zIht8Lv6D/vs= =vYBW -----END PGP SIGNATURE-----

On Thursday 14 October 2004 10:45, Matthias Dort wrote:
Wenn es sich um die Ausgabe von ls handelt, und man spezielle Daten einer Datei wissen möchte, kann man das auch einfacher haben: stat - display file or filesystem status Jürgen -- Dr.rer.nat. Juergen Vollmer, Viktoriastrasse 15, D-76133 Karlsruhe Tel: +49(721) 9204871 Fax: +49(721) 24874 Juergen.Vollmer@informatik-vollmer.de www.informatik-vollmer.de Internet-Telefonie: www.skype.com Benutzer: juergen.vollmer

Am Donnerstag, 14. Oktober 2004 10:45 schrieb Matthias Dort:
Hallo Ich stehe vor einem Änlichem problem in der SuSE9.1 geht mein lt nicht mehr:
Das kommt bei der SuSE9.0 raus. lt -rw-r--r-- 1 root root 1.7K Sep 4 13:24 syslog -rw-r--r-- 1 root root 1.7K Sep 4 13:24 dhcpd drwxr-xr-x 2 root root 72 Sep 4 13:25 daemons -rw-r--r-- 1 root root 490 Sep 4 13:25 spamd drwxr-xr-x 6 root root 424 Sep 5 14:57 network -rw-r--r-- 1 root root 949 Sep 5 15:33 antivir -rw-r--r-- 1 root root 343 Sep 20 11:26 samba 62 Dateien, 122,935 KBytes Gruss Patrice

On Thu, Oct 14, 2004 at 10:45:59AM +0200, Matthias Dort wrote:
Mit bash-eigenen Mitteln ist das soviel ich weiß auch nicht hinzubekommen (lasse mich gern vom Gegenteil überzeugen ;-)). Eine Möglichkeit wäre z.B.: string=`echo $string|awk '{print substr($0,index($0,$6))}'` f -- Gravity is a myth, the Earth sucks.

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thursday 14 October 2004 12:33, Florian Tham wrote:
Vielleicht hilft das weiter: opi:/home/r2 # ls -l x* | while read c1 c2 c3 c4 c5 rest; do echo "$rest"; done Sep 22 15:10 x Oct 9 20:36 x.iso Sep 22 15:10 x.pl Sep 22 14:56 x.pl~ Sep 26 21:56 x2.pl Sep 26 21:49 x2.pl~ Also: opi:/home/r2 # string="$(ls -l x.pl)" opi:/home/r2 # echo "$string" - -rw-r--r-- 1 r2 users 384 Sep 22 15:10 x.pl opi:/home/r2 # string="$(echo "$string" | (read c1 c2 c3 c4 c5 rest; echo $rest))" opi:/home/r2 # echo "$string" Sep 22 15:10 x.pl Torsten -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFBbnYOwicyCTir8T4RAlAQAKCjg/5dUip0utvg4G9zrDvYNJgtDgCgoBUL RksQ9xKksb1flIUwOBZfZmE= =gdbg -----END PGP SIGNATURE-----

On Thu, 14 Oct 2004, Florian Tham wrote:
Danke Florian und Torsten! Eure professionellen Lösungen haben mich wirklich sehr begeistert. Übrigens, könnte ich ohne letzte Mail von Florian die HTML-Mail von Torsten nicht lesen. Schönen Freitag und schönes Wochenende! peter

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday 15 October 2004 09:47, Matthias Dort wrote:
Übrigens, könnte ich ohne letzte Mail von Florian die HTML-Mail von Torsten nicht lesen.
Hallo Matthias, ich habe mal die Mail, so wie ich sie von der Liste empfangen habe, angehängt. Ich sehe dort kein bischen HTML, der Content-Type Header sagt, es sei text/plain. Auch KMail meint, es sei KEINE HTML Mail. Ich habe keine Ahnung, woher Du eine HTML Mail bekamst, von mir jedenfalls nicht. Ich verschicke solche aus Prinzip nicht. Allerdings wird meine Mail Adresse von Spammern öfters missbraucht, leider. Daher sind Mails, die wirklich von mir kommen gewöhnlich gpg-signiert. Torsten -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFBb4TCwicyCTir8T4RAtj3AJ9Re4/cuWPHLqVzg6nL5a9XbyUtzACdHrLW MCGeHb+Tgx7zIht8Lv6D/vs= =vYBW -----END PGP SIGNATURE-----
participants (5)
-
Dr. Jürgen Vollmer
-
Florian Tham
-
Matthias Dort
-
Patrice Staudt
-
Torsten Förtsch