<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>For on Marco Gabriel Blog</title>
    <link>https://www.marcogabriel.com/tags/for/</link>
    <description>Recent content in For on Marco Gabriel Blog</description>
    <image>
      <title>Marco Gabriel Blog</title>
      <url>https://www.marcogabriel.com/%3Clink%20or%20path%20of%20image%20for%20opengraph,%20twitter-cards%3E</url>
      <link>https://www.marcogabriel.com/%3Clink%20or%20path%20of%20image%20for%20opengraph,%20twitter-cards%3E</link>
    </image>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Sat, 20 Apr 2013 13:39:45 +0200</lastBuildDate>
    <atom:link href="https://www.marcogabriel.com/tags/for/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Bash: Zeile für Zeile</title>
      <link>https://www.marcogabriel.com/posts/617-bash-zeile-fuer-zeile/</link>
      <pubDate>Sat, 20 Apr 2013 13:39:45 +0200</pubDate>
      <guid>https://www.marcogabriel.com/posts/617-bash-zeile-fuer-zeile/</guid>
      <description>&lt;p&gt;Neulich musste ich für die Umstellung eines Mailsystems ca. 3.300 Aliase umschreiben. Da diese Aliase aus mehreren Quellen stammen sollte das ganze auch automatisch und jederzeit wiederholbar sein. Ich kam irgendwann an den Punkt, an dem ich eine Datei lesen und mit jeder Zeile etwas tun musste.&lt;/p&gt;
&lt;p&gt;Der Klassiker in Bash ist einfach:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;for LINE in $(cat /pfad/zur/datei)
do
    echo $LINE
done
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Dazu gibt es jedoch eine meist bessere Alternative:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;while read LINE
do
    echo $LINE
done &amp;lt; /pfad/zur/datei
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Variante 2 nutzt das read Kommando unter Linux und liest die Datei wirkich zeilenweise, wogegen Version 1 wortweise liest.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
