Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
welches Programm beherrscht reguläre Ausrdücke? [solved]
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German)
View previous topic :: View next topic  
Author Message
hakker82
Apprentice
Apprentice


Joined: 13 Jul 2004
Posts: 188

PostPosted: Mon Nov 15, 2004 4:29 pm    Post subject: welches Programm beherrscht reguläre Ausrdücke? [solved] Reply with quote

ich möchte gerne aus der Ausgabe von acpi -b (Battery 1: charged, 51%)
nur die 51% heraushaben. Welches Programm kann so etwas?

Wie funktioniert es.
Grep kann reguläre Ausdrücke, filtert aber nichts heraus.

Thx :?:


Last edited by hakker82 on Mon Nov 15, 2004 5:17 pm; edited 1 time in total
Back to top
View user's profile Send private message
sven-tek
Guru
Guru


Joined: 06 May 2003
Posts: 339

PostPosted: Mon Nov 15, 2004 5:10 pm    Post subject: Reply with quote

nimm sed dafür,

das müsste irgendwie so aussehen: acpi -b |sed -e 's/.*\([0-9][0-9]%\).*/\1/g'
Back to top
View user's profile Send private message
Haldir
Guru
Guru


Joined: 27 Sep 2002
Posts: 546

PostPosted: Mon Nov 15, 2004 5:11 pm    Post subject: Reply with quote

du suchst nach awk :)

irgendwas im dreh von acpi -b | awk '{print $3;}'

Mit der Nummer hinter print kannst festlegen was du ausgeben willst


Last edited by Haldir on Mon Nov 15, 2004 5:17 pm; edited 1 time in total
Back to top
View user's profile Send private message
chrib
Guru
Guru


Joined: 27 Sep 2003
Posts: 558
Location: Berlin, Germany

PostPosted: Mon Nov 15, 2004 5:13 pm    Post subject: Reply with quote

Man könnte natürlich auch mit Kanonen auf Spatzen schiessen und Perl nehmen.

Gruß
Christian
_________________
Der Mensch kämpft um zu überleben, und nicht, um zu Grunde zu gehen. - Paulo Coelho
It is the end of all hope. To lose the child, the faith. To end all the innocence. To be someone like me. - Nightwish - End of all hope
Back to top
View user's profile Send private message
hakker82
Apprentice
Apprentice


Joined: 13 Jul 2004
Posts: 188

PostPosted: Mon Nov 15, 2004 5:16 pm    Post subject: Reply with quote

Das mit sed ging

Danke

werde mal sed und awk genauer anschauen :D
Back to top
View user's profile Send private message
psyqil
Advocate
Advocate


Joined: 26 May 2003
Posts: 2767

PostPosted: Mon Nov 15, 2004 7:37 pm    Post subject: Reply with quote

Guckst Du hier: :D
http://www-106.ibm.com/developerworks/library/l-awk1.html
http://www-106.ibm.com/developerworks/linux/library/l-sed1.html
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum