Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved]Bash - Wie Datei Zeile für Zeile ausgeben lassen
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
z4Rilla
Apprentice
Apprentice


Joined: 22 Dec 2003
Posts: 291
Location: EU

PostPosted: Sat Feb 19, 2005 7:50 pm    Post subject: [Solved]Bash - Wie Datei Zeile für Zeile ausgeben lassen Reply with quote

Wie kann ich eine Datei Zeile für Zeile in einer for-Schleife verarbeiten ?
Code:
for line in ????
do
     ...
done

Und wo gibts ein gutes Tutorial für Bash-scripting


Last edited by z4Rilla on Sat Feb 19, 2005 8:12 pm; edited 1 time in total
Back to top
View user's profile Send private message
STiGMaTa_ch
Veteran
Veteran


Joined: 28 Dec 2004
Posts: 1686
Location: Rüti ZH / Schweiz

PostPosted: Sat Feb 19, 2005 7:55 pm    Post subject: Reply with quote

Code:

for line in `cat datei`
do
   ...
done


Quote:
Und wo gibts ein gutes Tutorial für Bash-scripting


Google! ;)

Lieber Gruss
STiGGi
Back to top
View user's profile Send private message
benjamin200
Veteran
Veteran


Joined: 01 Feb 2004
Posts: 1426
Location: DE Munich

PostPosted: Sat Feb 19, 2005 7:56 pm    Post subject: Reply with quote

Quote:

Und wo gibts ein gutes Tutorial für Bash-scripting


googeln:
http://www.google.de/search?hl=de&q=Tutorial+bash+scripting&spell=1



Gruß,
Benjamin
_________________
Gentoo Linux Stage1 / Kernel 2.6.18
AMD Athlon64 3500+ on Asus A8N-E / 1024 MB DDR-RAM / ATI X700 PCIe
Take LINUX and forget Blue Screens
Back to top
View user's profile Send private message
z4Rilla
Apprentice
Apprentice


Joined: 22 Dec 2003
Posts: 291
Location: EU

PostPosted: Sat Feb 19, 2005 7:58 pm    Post subject: Reply with quote

das hatte ich schon probiert. Da wird die Ausgabe von cat noch weiter auseinandergenommen (bei jedem Space)
Aber ich will ja das jede Zeile als ganzes in $line landet.
Back to top
View user's profile Send private message
STiGMaTa_ch
Veteran
Veteran


Joined: 28 Dec 2004
Posts: 1686
Location: Rüti ZH / Schweiz

PostPosted: Sat Feb 19, 2005 8:07 pm    Post subject: Reply with quote

z4Rilla wrote:
das hatte ich schon probiert. Da wird die Ausgabe von cat noch weiter auseinandergenommen (bei jedem Space)
Aber ich will ja das jede Zeile als ganzes in $line landet.


Achja, stimmt... die Spaces hab ich glatt vergessen:

Neuer Versuch ;)

Code:

while read LINE
do
   ...Zeileninhalt wird in Variable $LINE gespeichert...
done </pfad/zu/deiner/datei.txt


Lieber Gruss
STiGMaTa
Back to top
View user's profile Send private message
z4Rilla
Apprentice
Apprentice


Joined: 22 Dec 2003
Posts: 291
Location: EU

PostPosted: Sat Feb 19, 2005 8:12 pm    Post subject: Reply with quote

k, funktioniert.
thx
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