{"id":12640,"date":"2022-02-10T19:10:19","date_gmt":"2022-02-10T19:10:19","guid":{"rendered":"https:\/\/profi-tutorials.de\/linux\/?p=12640"},"modified":"2022-02-10T19:10:19","modified_gmt":"2022-02-10T19:10:19","slug":"befehl-cut","status":"publish","type":"post","link":"https:\/\/profi-tutorials.de\/linux\/grundlagen\/befehl-cut\/","title":{"rendered":"Der Befehl cut"},"content":{"rendered":"<p>In diesem Beitrag lernen Sie den Befehl cut kennen, welcher unter UNIX- \/ Linux-Betriebssystemen eingesetzt wird, um Informationen aus Textdateien spaltenweise auszuschneiden. Der Befehl erm&ouml;glicht so etwa die Extrahierung von wichtigen bzw. das Entfernen von unwichtigen Informationen aus Logdateien. Als Teil des essenziellen Pakets coreutils ist cut auf den meisten Systemen bereits vorinstalliert.<\/p>\n<h2 id=\"t-1643983573108\">Allgemeine Syntax<\/h2>\n<p>Die allgemeine <a class=\"glossaryLink cmtt_Allgemein cmtt_Informatik\" aria-describedby=\"tt\" data-cmtooltip=\"&lt;div class=glossaryItemTitle&gt;Syntax&lt;\/div&gt;&lt;div class=glossaryItemBody&gt;&#8203;Im  Allgemeinen wird unter Syntax ein Regel&#8203;system verstanden, welches zur  Kombination elementarer Zeichen zu zusammengesetzten &#8203;Zeichen in (...)&lt;\/div&gt;\" href=\"https:\/\/profi-tutorials.de\/linux\/glossar\/syntax\/\" target=\"_blank\" data-mobile-support=\"0\" data-gt-translate-attributes='[{\"attribute\":\"data-cmtooltip\", \"format\":\"html\"}]' tabindex=\"0\" role=\"link\">Syntax<\/a> von <strong>cut <\/strong>lautet folgenderma&szlig;en:<\/p>\n<pre>cut [Optionen] [Datei(en)]<\/pre>\n<p><strong>cut <\/strong>kann nicht ohne Angabe von Optionen ausgef&uuml;hrt werden, da diese unter anderem auch der Auswahl auszugebender Bytes, Zeichen oder Felder dienen (siehe Abschnitt <strong>&ldquo;Wichtige Optionen&rdquo;<\/strong>). Die Angabe des zu verwendenden Eingabetextes ist durch &Uuml;bergabe einer oder mehrerer Dateien m&ouml;glich. Alternativ kann auch vom Standard-Input stdin gelesen werden &ndash; hierzu muss anstelle der Dateien ein Minuszeichen &ldquo;-&rdquo; &uuml;bergeben werden.<\/p>\n<h2 id=\"t-1643983573109\">Wichtige Optionen<\/h2>\n<p>Dieser Abschnitt stellt die wichtigsten Optionen des Befehls <strong>cut <\/strong>vor. Es ist zu beachten, dass immer mindestens genau eine der drei <strong>Optionen -b<\/strong>, <strong>-c<\/strong> und <strong>-f<\/strong> angegeben werden muss. Diese drei Optionen k&ouml;nnen nicht untereinander kombiniert werden.<\/p>\n<h3 id=\"t-1643983573110\">-b &ndash; Bytes ausw&auml;hlen<\/h3>\n<p>Die <strong>Option -b<\/strong> dient der Auswahl der Positionen von <strong>Bytes<\/strong>, die von <strong>cut <\/strong>ausgegeben werden sollen.<\/p>\n<pre>cut -b [Liste] [Datei(en)]<\/pre>\n<p>Die Positionen dieser <strong>Bytes <\/strong>werden dabei in Form einer kommagetrennten Liste an <strong>Bereichen <\/strong>angegeben. Ein <strong>Bereich <\/strong>kann wie folgt angegeben werden:<\/p>\n<table data-rows=\"5\" data-cols=\"2\" data-v=\"middle\">\n<thead>\n<tr>\n<th style=\"\"><strong>Bereich<\/strong><\/th>\n<th style=\"\">Beschreibung<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td data-th=\"Bereich\" style=\"\">N<\/td>\n<td data-th=\"Beschreibung\" style=\"\">Spezifiziert das N-te Byte, Zeichen oder Feld.<\/td>\n<\/tr>\n<tr>\n<td data-th=\"Bereich\" style=\"\">N-<\/td>\n<td data-th=\"Beschreibung\" style=\"\">Spezifiziert alle Bytes, Zeichen oder Felder ab dem N-ten.<\/td>\n<\/tr>\n<tr>\n<td data-th=\"Bereich\" style=\"\">N-M<\/td>\n<td data-th=\"Beschreibung\" style=\"\">Spezifiziert alle Bytes, Zeichen oder Felder ab dem N-ten bis (inklusive) zum M-ten.<\/td>\n<\/tr>\n<tr>\n<td data-th=\"Bereich\" style=\"\">-M<\/td>\n<td data-th=\"Beschreibung\" style=\"\">Spezifiziert alle Bytes, Zeichen oder Felder ab dem ersten bis (inklusive) zum M-ten.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 id=\"t-1643983573111\">-c &ndash; Zeichen ausw&auml;hlen<\/h3>\n<p>Mithilfe der <strong>Option -c<\/strong> k&ouml;nnen die Positionen der <strong>Zeichen <\/strong>ausgew&auml;hlt werden, die von <strong>cut <\/strong>ausgegeben werden sollen. Die Positionen der <strong>Zeichen <\/strong>werden genauso wie bei der <strong>Option -b<\/strong> angegeben.<\/p>\n<pre>cut -c [Liste] [Datei(en)]<\/pre>\n<h3 id=\"t-1643983573112\">-d &ndash; Delimiter spezifizieren<\/h3>\n<p>Der f&uuml;r die Aufteilung in Felder verwendete <strong>Delimiter <\/strong>(<a class=\"glossaryLink cmtt_Informatik\" aria-describedby=\"tt\" data-cmtooltip=\"&lt;div class=glossaryItemTitle&gt;Delimiter&lt;\/div&gt;&lt;div class=glossaryItemBody&gt;Ein Delimiter oder Trennzeichen wird verwendet, um Text oder andere Datenstr&ouml;me in Elemente aufzuteilen.&lt;\/div&gt;&lt;div class=cmtt_synonyms_wrapper&gt;&lt;div class=cmtt_synonyms_title&gt;Synonyms: &lt;\/div&gt;&lt;div class=cmtt_synonyms&gt;Trennzeichen&lt;\/div&gt;&lt;\/div&gt;\" href=\"https:\/\/profi-tutorials.de\/linux\/glossar\/delimiter\/\" target=\"_blank\" data-mobile-support=\"0\" data-gt-translate-attributes='[{\"attribute\":\"data-cmtooltip\", \"format\":\"html\"}]' tabindex=\"0\" role=\"link\">Trennzeichen<\/a>) kann mithilfe der <strong>Option -d<\/strong> spezifiziert werden. Standardm&auml;&szlig;ig wird der <strong>Tabulator <\/strong>als <strong>Delimiter <\/strong>verwendet.<\/p>\n<pre>cut -d [Delimiter] [Datei(en)]<\/pre>\n<h3 id=\"t-1643983573113\">-f &ndash; Felder ausw&auml;hlen<\/h3>\n<p>Die <strong>Option -f<\/strong> erm&ouml;glicht die Auswahl an <strong>Feldern<\/strong>, die von <strong>cut <\/strong>ausgegeben werden sollen. <strong>Felder <\/strong>werden dabei durch einen Delimiter voneinander getrennt &ndash; standardm&auml;&szlig;ig ist das der Tabulator (siehe <strong>Option -d<\/strong>). Standardm&auml;&szlig;ig wird au&szlig;erdem jede Zeile ausgegeben, die den Delimiter nicht enth&auml;lt. Auch hier werden die Positionen wieder so angegeben, wie bei der <strong>Option -b<\/strong>.<\/p>\n<pre>cut -f [Liste] [Datei(en)]<\/pre>\n<h5>Beispiel: Option -f<\/h5>\n<h6 style=\"\"><span style=\"font-weight: normal;\">Dieses Beispiel zeigt das Extrahieren eines einzelnen Feldes aus der <\/span>\/etc\/passwd<span style=\"font-weight: normal;\"> mithilfe der <\/span>Option -f<span style=\"font-weight: normal;\"> von <\/span>cut<span style=\"font-weight: normal;\">. Die Felder der <\/span>\/etc\/passwd<span style=\"font-weight: normal;\"> sind durch <\/span>Doppelpunkte &ldquo;:&rdquo;<span style=\"font-weight: normal;\"> voneinander getrennt, weswegen hier zus&auml;tzlich auch die <\/span>Option -d<span style=\"font-weight: normal;\"> eingesetzt wird.<\/span><\/h6>\n<h6>Inhalt \/etc\/passwd:<\/h6>\n<p style=\"\">Im Folgenden sind die ersten vier Zeilen der hier verwendeten <strong>\/etc\/passwd<\/strong> zu sehen. Zugunsten einer besseren &Uuml;bersicht betrachten wir die &uuml;brigen Zeilen der Datei nicht.<\/p>\n<p><a class=\"glossaryLink cmtt_Informatik\" aria-describedby=\"tt\" data-cmtooltip=\"&lt;div class=glossaryItemTitle&gt;Root-Benutzer&lt;\/div&gt;&lt;div class=glossaryItemBody&gt;Der Root-Benutzer ist der m&auml;chtigste Benutzer-Account auf Linux-Systemen.&lt;\/div&gt;\" href=\"https:\/\/profi-tutorials.de\/linux\/glossar\/root-benutzer\/\" target=\"_blank\" data-mobile-support=\"0\" data-gt-translate-attributes='[{\"attribute\":\"data-cmtooltip\", \"format\":\"html\"}]' tabindex=\"0\" role=\"link\">root<\/a>:x:0:0:root:\/root:\/bin\/bashdaemon:x:1:1:daemon:\/usr\/sbin:\/usr\/sbin\/nologinbin:x:2:2:bin:\/bin:\/usr\/sbin\/nologinsys:x:3:3:sys:\/dev:\/usr\/sbin\/nologin<\/p>\n<h6>Eingabe:<\/h6>\n<p>Es wird nun <strong>cut <\/strong>aufgerufen, wobei neben dem Dateinamen auch die <strong>Option -d<\/strong> mit dem <strong>Doppelpunkt &ldquo;:&rdquo;<\/strong> sowie die <strong>Option -f<\/strong> mit einer <strong>1<\/strong> &uuml;bergeben werden. Die Felder werden somit mit dem <strong>Doppelpunkt &ldquo;:&rdquo;<\/strong> getrennt und das erste Feld extrahiert.<\/p>\n<p>cut -d : -f 1 \/etc\/passwd<\/p>\n<h6>Nach Ausf&uuml;hrung:<\/h6>\n<p>In der Ausgabe sind nun zeilenweise die ersten Felder der Eintr&auml;ge bzw. die <strong>Benutzernamen <\/strong>aus der <strong>\/etc\/passwd<\/strong> zu sehen.<\/p>\n<p>rootdaemonbinsys<\/p>\n<h3 id=\"t-1643983573114\">-s &ndash; Zeilen ohne Trennzeichen ignorieren<\/h3>\n<p>Das Standardverhalten, bei dem Zeilen ohne Trennzeichen einfach ausgegeben werden, l&auml;sst sich mithilfe der <strong>Option -s<\/strong> deaktivieren. Stattdessen werden solche Zeilen dann ignoriert und sind nicht l&auml;nger Teil der Ausgabe.<\/p>\n<pre>cut -s [Datei(en)]<\/pre>\n<h3 id=\"t-1643983573115\">-z &ndash; Zeilen mit Nullbyte trennen<\/h3>\n<p>Standardm&auml;&szlig;ig werden Zeilen mit dem <strong>Zeilenumbruch <\/strong>getrennt. Mit der <strong>Option -z<\/strong> l&auml;sst sich stattdessen die Verwendung des <strong>Nullbyte <\/strong>(NUL) f&uuml;r die Trennung der Zeilen aktivieren.<\/p>\n<pre>cut -z [Datei(en)]<\/pre>\n<p style=\"text-align: center;\">Abonniere JETZT unseren Newsletter!<\/p>\n<p style=\"text-align: center;\">Verpasse nie wieder <strong>neue<\/strong> Beitr&auml;ge und <strong>exklusive Insider-Only-Inhalte!<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In diesem Beitrag lernen Sie den Befehl cut kennen, welcher unter UNIX- \/ Linux-Betriebssystemen eingesetzt wird, um Informationen aus Textdateien spaltenweise auszuschneiden. Der Befehl erm\u00f6glicht so etwa die Extrahierung von wichtigen bzw. das Entfernen von unwichtigen Informationen aus Logdateien. Als Teil des essenziellen Pakets coreutils ist cut auf den meisten Systemen bereits vorinstalliert. Allgemeine Syntax [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":12643,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","tve_updated_post":"<div class=\"thrv_wrapper thrv_text_element\">\t<p>In diesem Beitrag lernen Sie den Befehl cut kennen, welcher unter UNIX- \/ Linux-Betriebssystemen eingesetzt wird, um Informationen aus Textdateien spaltenweise auszuschneiden. Der Befehl erm\u00f6glicht so etwa die Extrahierung von wichtigen bzw. das Entfernen von unwichtigen Informationen aus Logdateien. Als Teil des essenziellen Pakets coreutils ist cut auf den meisten Systemen bereits vorinstalliert.<\/p><\/div><div class=\"thrv_wrapper thrv_contents_table\" data-columns=\"2\" data-headers=\"h2,h3\">\n\t<div class=\"tve_contents_table\">\n\t\t<span class=\"tve_ct_title\" style=\"\" data-css=\"tve-u-17ec50f0c0e\">Inhaltsverzeichnis<\/span>\n\t\t<div class=\"tve_ct_content tve_clearfix\"><div class=\"ct_column\"><div class=\"tve_ct_level0\"><a href=\"#t-1643983573108\" rel=\"nofollow\">Allgemeine Syntax<\/a><\/div><\/div><div class=\"ct_column\"><div class=\"tve_ct_level0\"><a href=\"#t-1643983573109\" rel=\"nofollow\">Wichtige Optionen<\/a><\/div><div class=\"tve_ct_level1\"><a href=\"#t-1643983573110\" rel=\"nofollow\">-b - Bytes ausw\u00e4hlen<\/a><\/div><div class=\"tve_ct_level1\"><a href=\"#t-1643983573111\" rel=\"nofollow\">-c - Zeichen ausw\u00e4hlen<\/a><\/div><div class=\"tve_ct_level1\"><a href=\"#t-1643983573112\" rel=\"nofollow\">-d - Delimiter spezifizieren<\/a><\/div><div class=\"tve_ct_level1\"><a href=\"#t-1643983573113\" rel=\"nofollow\">-f - Felder ausw\u00e4hlen<\/a><\/div><div class=\"tve_ct_level1\"><a href=\"#t-1643983573114\" rel=\"nofollow\">-s - Zeilen ohne Trennzeichen ignorieren<\/a><\/div><div class=\"tve_ct_level1\"><a href=\"#t-1643983573115\" rel=\"nofollow\">-z - Zeilen mit Nullbyte trennen<\/a><\/div><\/div><\/div>\n\t<\/div>\n<\/div><div class=\"thrv_wrapper thrv_text_element\"><h2 class=\"\" id=\"t-1643983573108\">Allgemeine Syntax<\/h2><p>Die allgemeine Syntax von <strong>cut <\/strong>lautet folgenderma\u00dfen:<\/p><p>[code]cut [Optionen] [Datei(en)][\/code]<\/p><p><strong>cut <\/strong>kann nicht ohne Angabe von Optionen ausgef\u00fchrt werden, da diese unter anderem auch der Auswahl auszugebender Bytes, Zeichen oder Felder dienen (siehe Abschnitt <strong>\"Wichtige Optionen\"<\/strong>). Die Angabe des zu verwendenden Eingabetextes ist durch \u00dcbergabe einer oder mehrerer Dateien m\u00f6glich. Alternativ kann auch vom Standard-Input stdin gelesen werden - hierzu muss anstelle der Dateien ein Minuszeichen \"-\" \u00fcbergeben werden.<\/p><h2 class=\"\" id=\"t-1643983573109\">Wichtige Optionen<\/h2><p>Dieser Abschnitt stellt die wichtigsten Optionen des Befehls <strong>cut <\/strong>vor. Es ist zu beachten, dass immer mindestens genau eine der drei <strong>Optionen -b<\/strong>, <strong>-c<\/strong> und <strong>-f<\/strong> angegeben werden muss. Diese drei Optionen k\u00f6nnen nicht untereinander kombiniert werden.<\/p><h3 class=\"\" id=\"t-1643983573110\">-b - Bytes ausw\u00e4hlen<\/h3><p>Die <strong>Option -b<\/strong> dient der Auswahl der Positionen von <strong>Bytes<\/strong>, die von <strong>cut <\/strong>ausgegeben werden sollen.<\/p><p>[code]cut -b [Liste] [Datei(en)][\/code]<\/p><p>Die Positionen dieser <strong>Bytes <\/strong>werden dabei in Form einer kommagetrennten Liste an <strong>Bereichen <\/strong>angegeben. Ein <strong>Bereich <\/strong>kann wie folgt angegeben werden:<\/p><\/div><div class=\"thrv_wrapper thrv_table tcb-fixed tcb-mobile-table\" data-ct-name=\"Simple 01\" data-ct=\"table-37694\" data-element-name=\"Table\" data-css=\"tve-u-17ec54f9f60\"><table data-rows=\"5\" data-cols=\"2\" class=\"tve_table tcb-fixed tve_table_flat\" data-css=\"tve-u-17ec54f9f5e\" data-v=\"middle\"><thead data-css=\"tve-u-17ec54f9f61\"><tr class=\"tve_table_row\"><th class=\"tve_table_cell\" style=\"\" data-css=\"tve-u-17ec54f9f6a\"><div class=\"thrv_wrapper thrv_text_element\" data-css=\"tve-u-1702ecf6b87\"><p data-css=\"tve-u-17ec54f9f69\"><strong>Bereich<\/strong><\/p><\/div><\/th><th class=\"tve_table_cell\" style=\"\" data-css=\"tve-u-1702eea2d74\"><div class=\"thrv_wrapper thrv_text_element\"><p data-css=\"tve-u-17ec54f9f6b\">Beschreibung<\/p><\/div><\/th><\/tr><\/thead><tbody data-css=\"tve-u-17ec54f9f65\"><tr class=\"tve_table_row\"><td class=\"tve_table_cell\" data-th=\"Bereich\" data-css=\"tve-u-17ec54f9f6f\" style=\"\"><div class=\"thrv_wrapper thrv_text_element\" data-css=\"tve-u-1702ecf6b8f\"><p>N<\/p><\/div><\/td><td class=\"tve_table_cell\" data-th=\"Beschreibung\" data-css=\"tve-u-17ec54f9f72\" style=\"\"><div class=\"thrv_wrapper thrv_text_element\" data-css=\"tve-u-1702ecf6b8f\"><p>Spezifiziert das N-te Byte, Zeichen oder Feld.<\/p><\/div><\/td><\/tr><tr class=\"tve_table_row\"><td class=\"tve_table_cell\" data-th=\"Bereich\" data-css=\"tve-u-17ec54f9f70\" style=\"\"><div class=\"thrv_wrapper thrv_text_element\" data-css=\"tve-u-1702ecf6b8f\"><p>N-<\/p><\/div><\/td><td class=\"tve_table_cell\" data-th=\"Beschreibung\" data-css=\"tve-u-17ec54f9f73\" style=\"\"><div class=\"thrv_wrapper thrv_text_element\" data-css=\"tve-u-1702ecf6b8f\"><p>Spezifiziert alle Bytes, Zeichen oder Felder ab dem N-ten.<\/p><\/div><\/td><\/tr><tr class=\"tve_table_row\"><td class=\"tve_table_cell\" data-th=\"Bereich\" data-css=\"tve-u-17ec54f9f71\" style=\"\"><div class=\"thrv_wrapper thrv_text_element\" data-css=\"tve-u-1702ecf6b8f\"><p>N-M<\/p><\/div><\/td><td class=\"tve_table_cell\" data-th=\"Beschreibung\" data-css=\"tve-u-17ec54f9f74\" style=\"\"><div class=\"thrv_wrapper thrv_text_element\" data-css=\"tve-u-1702ecf6b8f\"><p>Spezifiziert alle Bytes, Zeichen oder Felder ab dem N-ten bis (inklusive) zum M-ten.<\/p><\/div><\/td><\/tr><tr class=\"tve_table_row\"><td class=\"tve_table_cell\" data-th=\"Bereich\" data-css=\"tve-u-17ec54f9f75\" style=\"\"><div class=\"thrv_wrapper thrv_text_element\" data-css=\"tve-u-1702ecf6b8f\"><p>-M<\/p><\/div><\/td><td class=\"tve_table_cell\" data-th=\"Beschreibung\" data-css=\"tve-u-17ec54f9f76\" style=\"\"><div class=\"thrv_wrapper thrv_text_element\" data-css=\"tve-u-1702ecf6b8f\"><p>Spezifiziert alle Bytes, Zeichen oder Felder ab dem ersten bis (inklusive) zum M-ten.<\/p><\/div><\/td><\/tr><\/tbody><\/table><\/div><div class=\"thrv_wrapper thrv_text_element\"><h3 class=\"\" id=\"t-1643983573111\">-c - Zeichen ausw\u00e4hlen<\/h3><p>Mithilfe der <strong>Option -c<\/strong> k\u00f6nnen die Positionen der <strong>Zeichen <\/strong>ausgew\u00e4hlt werden, die von <strong>cut <\/strong>ausgegeben werden sollen. Die Positionen der <strong>Zeichen <\/strong>werden genauso wie bei der <strong>Option -b<\/strong> angegeben.<\/p><p>[code]cut -c [Liste] [Datei(en)][\/code]<\/p><h3 class=\"\" id=\"t-1643983573112\">-d - Delimiter spezifizieren<\/h3><p>Der f\u00fcr die Aufteilung in Felder verwendete <strong>Delimiter <\/strong>(Trennzeichen) kann mithilfe der <strong>Option -d<\/strong> spezifiziert werden. Standardm\u00e4\u00dfig wird der <strong>Tabulator <\/strong>als <strong>Delimiter <\/strong>verwendet.<\/p><p>[code]cut -d [Delimiter] [Datei(en)][\/code]<\/p><h3 class=\"\" id=\"t-1643983573113\">-f - Felder ausw\u00e4hlen<\/h3><p>Die <strong>Option -f<\/strong> erm\u00f6glicht die Auswahl an <strong>Feldern<\/strong>, die von <strong>cut <\/strong>ausgegeben werden sollen. <strong>Felder <\/strong>werden dabei durch einen Delimiter voneinander getrennt - standardm\u00e4\u00dfig ist das der Tabulator (siehe <strong>Option -d<\/strong>). Standardm\u00e4\u00dfig wird au\u00dferdem jede Zeile ausgegeben, die den Delimiter nicht enth\u00e4lt. Auch hier werden die Positionen wieder so angegeben, wie bei der <strong>Option -b<\/strong>.<\/p><p>[code]cut -f [Liste] [Datei(en)][\/code]<\/p><\/div><div class=\"thrv_wrapper thrv_contentbox_shortcode thrv-content-box tve-elem-default-pad\" data-css=\"tve-u-17ee4610543\" style=\"\">\n\t<div class=\"tve-content-box-background\" style=\"\" data-css=\"tve-u-17ee461053c\"><\/div>\n\t<div class=\"tve-cb\"><div class=\"thrv_wrapper thrv_text_element\" data-css=\"tve-u-17ee461053b\" style=\"\"><h5 class=\"\" data-css=\"tve-u-17ee461053a\">Beispiel: Option -f<\/h5><\/div><div class=\"thrv_wrapper thrv-divider\" data-style-d=\"tve_sep-1\" data-thickness-d=\"2\" data-color-d=\"rgb(66, 66, 66)\" data-css=\"tve-u-17ee461053d\" style=\"\">\n\t<hr class=\"tve_sep tve_sep-1\" style=\"\">\n<\/div><div class=\"thrv_wrapper thrv_text_element\"><h6 class=\"\" style=\"\" data-css=\"tve-u-17ee4610545\"><span style=\"font-weight: normal;\">Dieses Beispiel zeigt das Extrahieren eines einzelnen Feldes aus der <\/span>\/etc\/passwd<span style=\"font-weight: normal;\"> mithilfe der <\/span>Option -f<span style=\"font-weight: normal;\"> von <\/span>cut<span style=\"font-weight: normal;\">. Die Felder der <\/span>\/etc\/passwd<span style=\"font-weight: normal;\"> sind durch <\/span>Doppelpunkte \":\"<span style=\"font-weight: normal;\"> voneinander getrennt, weswegen hier zus\u00e4tzlich auch die <\/span>Option -d<span style=\"font-weight: normal;\"> eingesetzt wird.<\/span><\/h6><\/div><div class=\"thrv_wrapper thrv_text_element\"><h6 class=\"\">Inhalt \/etc\/passwd:<\/h6><p style=\"\" data-css=\"tve-u-17ee4610542\">Im Folgenden sind die ersten vier Zeilen der hier verwendeten <strong>\/etc\/passwd<\/strong> zu sehen. Zugunsten einer besseren \u00dcbersicht betrachten wir die \u00fcbrigen Zeilen der Datei nicht.<\/p><\/div><div class=\"thrv_wrapper thrv_text_element\" style=\"\" data-css=\"tve-u-17ee461053f\"><p data-css=\"tve-u-17ee4610540\">root:x:0:0:root:\/root:\/bin\/bash<br>daemon:x:1:1:daemon:\/usr\/sbin:\/usr\/sbin\/nologin<br>bin:x:2:2:bin:\/bin:\/usr\/sbin\/nologin<br>sys:x:3:3:sys:\/dev:\/usr\/sbin\/nologin<\/p><\/div><div class=\"thrv_wrapper thrv_text_element\" style=\"\" data-css=\"tve-u-17ee4610544\"><h6 class=\"\">Eingabe:<\/h6><p data-css=\"tve-u-17ee4610541\">Es wird nun <strong>cut <\/strong>aufgerufen, wobei neben dem Dateinamen auch die <strong>Option -d<\/strong> mit dem <strong>Doppelpunkt \":\"<\/strong> sowie die <strong>Option -f<\/strong> mit einer <strong>1<\/strong> \u00fcbergeben werden. Die Felder werden somit mit dem <strong>Doppelpunkt \":\"<\/strong> getrennt und das erste Feld extrahiert.<\/p><\/div><div class=\"thrv_wrapper thrv_text_element\" style=\"\" data-css=\"tve-u-17ee461053f\"><p data-css=\"tve-u-17ee4610540\">cut -d : -f 1 \/etc\/passwd<\/p><\/div><div class=\"thrv_wrapper thrv_text_element\" style=\"\" data-css=\"tve-u-17ee4610544\"><h6 class=\"\">Nach Ausf\u00fchrung:<\/h6><p data-css=\"tve-u-17ee4610541\">In der Ausgabe sind nun zeilenweise die ersten Felder der Eintr\u00e4ge bzw. die <strong>Benutzernamen <\/strong>aus der <strong>\/etc\/passwd<\/strong> zu sehen.<\/p><\/div><div class=\"thrv_wrapper thrv_text_element\" style=\"\" data-css=\"tve-u-17ee461053f\"><p data-css=\"tve-u-17ee4610540\">root<br>daemon<br>bin<br>sys<\/p><\/div><\/div>\n<\/div><div class=\"thrv_wrapper thrv_text_element\"><h3 class=\"\" id=\"t-1643983573114\">-s - Zeilen ohne Trennzeichen ignorieren<\/h3><p>Das Standardverhalten, bei dem Zeilen ohne Trennzeichen einfach ausgegeben werden, l\u00e4sst sich mithilfe der <strong>Option -s<\/strong> deaktivieren. Stattdessen werden solche Zeilen dann ignoriert und sind nicht l\u00e4nger Teil der Ausgabe.<\/p><p>[code]cut -s [Datei(en)][\/code]<\/p><h3 class=\"\" id=\"t-1643983573115\">-z - Zeilen mit Nullbyte trennen<\/h3><p>Standardm\u00e4\u00dfig werden Zeilen mit dem <strong>Zeilenumbruch <\/strong>getrennt. Mit der <strong>Option -z<\/strong> l\u00e4sst sich stattdessen die Verwendung des <strong>Nullbyte <\/strong>(NUL) f\u00fcr die Trennung der Zeilen aktivieren.<\/p><p>[code]cut -z [Datei(en)][\/code]<\/p><\/div><div class=\"thrv_wrapper thrv_contentbox_shortcode thrv-content-box tve-elem-default-pad\" style=\"\" data-css=\"tve-u-17ec50f267f\">\n\t<div class=\"tve-content-box-background\" style=\"\" data-css=\"tve-u-17ec50f2682\"><\/div>\n\t<div class=\"tve-cb\"><div class=\"thrv_wrapper thrv_text_element\" style=\"\" data-css=\"tve-u-17ec50f2681\"><p data-css=\"tve-u-17ec50f267e\" style=\"text-align: center;\">Abonniere JETZT unseren Newsletter!<\/p><\/div><div class=\"thrv_wrapper thrv-divider\" data-style-d=\"tve_sep-1\" data-thickness-d=\"3\" data-color-d=\"rgb(70, 70, 70)\" data-css=\"tve-u-17ec50f2683\" style=\"\">\n\t<hr class=\"tve_sep tve_sep-1\" style=\"\">\n<\/div><div class=\"thrv_wrapper thrv_text_element\" style=\"\" data-css=\"tve-u-17ec50f2680\"><p data-css=\"tve-u-17ec50f2684\" style=\"text-align: center;\">Verpasse nie wieder <strong>neue<\/strong> Beitr\u00e4ge und <strong>exklusive Insider-Only-Inhalte!<\/strong><\/p><\/div><div class=\"thrv_wrapper thrv_lead_generation\" data-connection=\"custom-html\" data-css=\"tve-u-17ec50f2686\" style=\"\" data-settings-id=\"12644\" data-form-settings=\"__TCB_FORM__{&quot;v&quot;:1,&quot;apis&quot;:{},&quot;extra&quot;:{},&quot;captcha&quot;:0,&quot;custom_tags&quot;:{}}__TCB_FORM__\"><input type=\"hidden\" class=\"tve-lg-err-msg\" value=\"{&quot;email&quot;:&quot;Email address invalid&quot;,&quot;phone&quot;:&quot;Phone number invalid&quot;,&quot;password&quot;:&quot;Password invalid&quot;,&quot;passwordmismatch&quot;:&quot;Password mismatch error&quot;,&quot;required&quot;:&quot;Required field missing&quot;}\">\n\t<div class=\"thrv_lead_generation_container tve_clearfix\"><form method=\"post\" action=\"#\" id=\"ktv2-form-200765\" novalidate=\"novalidate\" autocomplete=\"new-password\"><input type=\"hidden\" class=\"tve-f-a-hidden\" value=\"https:\/\/www.klick-tipp.com\/api\/subscriber\/signin.html\"><input id=\"apikey\" type=\"hidden\" name=\"apikey\" value=\"4nv5z2tonz8za09b\"><div class=\"tve_lead_generated_inputs_container\"><div class=\"tve_lg_input_container tve_lg_input\"><input name=\"fields[fieldFirstName]\" id=\"\" type=\"text\" placeholder=\"Name\" value=\"\" data-css=\"tve-u-1709bd3f99e\" data-placeholder=\"Name\"><\/div><div class=\"tve_lg_input_container tve_lg_input\"><input name=\"email\" id=\"\" type=\"text\" placeholder=\"E-Mail\" value=\"\" data-required=\"1\" data-validation=\"email\" data-css=\"tve-u-1709bd3f99e\" data-placeholder=\"E-Mail\"><\/div><div class=\"tve_lg_input_container tve_submit_container tve_lg_submit\" data-css=\"tve-u-17ec50f2687\"><button type=\"submit\" class=\"\">KLICKE HIER F\u00dcR ABO!<\/button><\/div><\/div><\/form><\/div>\n<div class=\"thrv_lead_generation_code\" style=\"display: none;\">__CONFIG_lead_generation_code__<div id=\"form-200765-wrapper\"><form id=\"ktv2-form-200765\" accept-charset=\"UTF-8\" method=\"post\" action=\"https:\/\/www.klick-tipp.com\/api\/subscriber\/signin.html\" autocomplete=\"new-password\"><input type=\"hidden\" name=\"apikey\" value=\"4nv5z2tonz8za09b\"><input type=\"text\" name=\"fields[fieldFirstName]\"><input type=\"text\" name=\"email\"><\/form><\/div>__CONFIG_lead_generation_code__<\/div><\/div><\/div>\n<\/div>","tve_custom_css":"@import url(\"\/\/fonts.googleapis.com\/css?family=Open+Sans:400,600&subset=latin\");@media (min-width: 300px){[data-css=\"tve-u-17ec50f0c0e\"] { background-color: var(--tcb-color-3); }:not(#tve) [data-css=\"tve-u-17ec50f267e\"] { font-size: 25px !important; font-weight: var(--g-bold-weight,bold) !important; padding-bottom: 0px !important; margin-bottom: 0px !important; padding-top: 0px !important; margin-top: 0px !important; color: rgb(70, 70, 70) !important; --tcb-applied-color:var$(--tcb-color-1) !important; }[data-css=\"tve-u-17ec50f267f\"] { padding: 10px !important; }[data-css=\"tve-u-17ec50f2680\"] { margin-left: 0px !important; margin-right: 0px !important; padding-right: 30px !important; padding-left: 30px !important; }[data-css=\"tve-u-17ec50f2681\"] { margin-right: 0px !important; margin-left: 0px !important; }[data-css=\"tve-u-17ec50f2682\"] { border-radius: 30px; overflow: hidden; background-image: linear-gradient(rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.08)) !important; background-size: auto !important; background-position: 50% 50% !important; background-attachment: scroll !important; background-repeat: no-repeat !important; }[data-css=\"tve-u-17ec50f2683\"] .tve_sep { border-width: 3px !important; border-color: rgb(70, 70, 70) !important; }[data-css=\"tve-u-17ec50f2683\"] { padding-top: 0px !important; }:not(#tve) [data-css=\"tve-u-17ec50f2684\"] { color: rgb(70, 70, 70) !important; --tcb-applied-color:var$(--tcb-color-1) !important; padding-bottom: 0px !important; margin-bottom: 0px !important; font-size: 18px !important; }[data-css=\"tve-u-17ec50f2686\"] { float: none; border: none; max-width: 500px !important; margin-left: auto !important; margin-right: auto !important; }:not(#tve) [data-css=\"tve-u-17ec50f2687\"] button { border-bottom: 4px solid rgb(33, 72, 112); border-radius: 4px; border-top: none; border-right: none; border-left: none; font-weight: var(--tve-font-weight,var(--g-bold-weight,bold)); font-family: var(--tve-font-family,\"Open Sans\"); font-size: var(--tve-font-size,18px); text-transform: var(--tve-text-transform,uppercase); background-image: none !important; background-color: rgb(51, 103, 153) !important; }:not(#tve) [data-css=\"tve-u-17ec50f2687\"]:hover button { background-image: none !important; background-color: rgb(41, 84, 127) !important; border-color: rgb(229, 227, 227) rgb(229, 227, 227) rgb(24, 54, 86) !important; }[data-css=\"tve-u-17ec50f2687\"] { --tve-font-weight:var(--g-bold-weight,bold); --tve-font-family:\"Open Sans\"; --g-regular-weight:400; --g-bold-weight:600; --tve-font-size:18px; --tve-text-transform:uppercase; }:not(#tve) [data-css=\"tve-u-17ec54f9f5e\"] { border: 1px solid rgb(220, 227, 233); }:not(#tve) [data-css=\"tve-u-17ec54f9f60\"] > .tve_table > thead > tr > th { background-color: var(--tcb-color-3); }:not(#tve) [data-css=\"tve-u-17ec54f9f60\"] > .tve_table > tbody > tr:nth-child(2n) > td { background-color: rgb(246, 246, 246); }:not(#tve) [data-css=\"tve-u-17ec54f9f60\"] > .tve_table > tbody > tr:nth-child(2n+1) > td { background-color: rgb(255, 255, 255); }:not(#tve) [data-css=\"tve-u-17ec54f9f61\"] p, :not(#tve) [data-css=\"tve-u-17ec54f9f61\"] li, :not(#tve) [data-css=\"tve-u-17ec54f9f61\"] blockquote, :not(#tve) [data-css=\"tve-u-17ec54f9f61\"] address, :not(#tve) [data-css=\"tve-u-17ec54f9f61\"] .tcb-plain-text, :not(#tve) [data-css=\"tve-u-17ec54f9f61\"] label, :not(#tve) [data-css=\"tve-u-17ec54f9f61\"] h1, :not(#tve) [data-css=\"tve-u-17ec54f9f61\"] h2, :not(#tve) [data-css=\"tve-u-17ec54f9f61\"] h3, :not(#tve) [data-css=\"tve-u-17ec54f9f61\"] h4, :not(#tve) [data-css=\"tve-u-17ec54f9f61\"] h5, :not(#tve) [data-css=\"tve-u-17ec54f9f61\"] h6 { color: rgb(255, 255, 255); }:not(#tve) [data-css=\"tve-u-17ec54f9f65\"] p, :not(#tve) [data-css=\"tve-u-17ec54f9f65\"] li, :not(#tve) [data-css=\"tve-u-17ec54f9f65\"] blockquote, :not(#tve) [data-css=\"tve-u-17ec54f9f65\"] address, :not(#tve) [data-css=\"tve-u-17ec54f9f65\"] .tcb-plain-text, :not(#tve) [data-css=\"tve-u-17ec54f9f65\"] label, :not(#tve) [data-css=\"tve-u-17ec54f9f65\"] h1, :not(#tve) [data-css=\"tve-u-17ec54f9f65\"] h2, :not(#tve) [data-css=\"tve-u-17ec54f9f65\"] h3, :not(#tve) [data-css=\"tve-u-17ec54f9f65\"] h4, :not(#tve) [data-css=\"tve-u-17ec54f9f65\"] h5, :not(#tve) [data-css=\"tve-u-17ec54f9f65\"] h6 { color: rgb(84, 85, 88); }[data-css=\"tve-u-17ec54f9f60\"] .tve_table td, [data-css=\"tve-u-17ec54f9f60\"] .tve_table th { padding: 0px; text-align: center; vertical-align: middle; }:not(#tve) [data-css=\"tve-u-17ec54f9f69\"] { font-size: 16px !important; font-family: \"Open Sans\" !important; font-weight: 400 !important; }[data-css=\"tve-u-17ec54f9f69\"] strong { font-weight: 600 !important; }:not(#tve) [data-css=\"tve-u-17ec54f9f5e\"] > tbody > tr > td { border: 0px none rgb(220, 227, 233); }:not(#tve) [data-css=\"tve-u-17ec54f9f5e\"] > thead > tr > th { border: 1px solid var(--tcb-color-3); }:not(#tve) [data-css=\"tve-u-17ec54f9f6a\"] { width: 97px; }:not(#tve) [data-css=\"tve-u-17ec54f9f6b\"] { font-size: 16px !important; }:not(#tve) [data-css=\"tve-u-17ee461053a\"] { padding-top: 0px !important; margin-top: 0px !important; }[data-css=\"tve-u-17ee461053b\"] { overflow: hidden; background-color: transparent !important; background-image: none !important; border-radius: 0px !important; }[data-css=\"tve-u-17ee461053c\"] { border-radius: 30px; overflow: hidden; background-image: linear-gradient(rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.08)) !important; background-size: auto !important; background-position: 50% 50% !important; background-attachment: scroll !important; background-repeat: no-repeat !important; }[data-css=\"tve-u-17ee461053d\"] .tve_sep { border-width: 2px !important; border-color: rgb(66, 66, 66) !important; }[data-css=\"tve-u-17ee461053d\"] { padding-top: 0px !important; padding-bottom: 10px !important; }[data-css=\"tve-u-17ee461053f\"] { background-image: linear-gradient(rgba(0, 0, 0, 0.13), rgba(0, 0, 0, 0.13)) !important; background-size: auto !important; background-position: 50% 50% !important; background-attachment: scroll !important; background-repeat: no-repeat !important; margin-bottom: 0px !important; padding: 5px 10px !important; }:not(#tve) [data-css=\"tve-u-17ee4610540\"] { padding-bottom: 0px !important; margin-bottom: 0px !important; font-family: \"Courier New\", Courier, monospace !important; font-weight: var(--g-regular-weight, normal)  !important; }:not(#tve) [data-css=\"tve-u-17ee4610541\"] { padding-bottom: 0px !important; margin-bottom: 0px !important; }:not(#tve) [data-css=\"tve-u-17ee4610542\"] { padding-bottom: 0px !important; margin-bottom: 0px !important; }[data-css=\"tve-u-17ee4610543\"] { padding-bottom: 20px !important; }[data-css=\"tve-u-17ee4610544\"] { margin-bottom: 0px !important; }:not(#tve) [data-css=\"tve-u-17ee4610545\"] { line-height: 2em !important; padding-bottom: 0px !important; margin-bottom: 0px !important; padding-top: 0px !important; margin-top: 0px !important; }}@media (max-width: 767px){.tcb-mobile-table [data-css=\"tve-u-17ec54f9f6f\"]::before { background-color: rgb(51, 103, 153); border-right: 1px solid rgb(51, 103, 153); padding: 0px; text-align: center; font-size: 16px; line-height: 32px; color: rgb(255, 255, 255); font-weight: 400; font-family: \"Open Sans\"; }.tcb-mobile-table [data-css=\"tve-u-17ec54f9f70\"]::before { background-color: rgb(51, 103, 153); border-right: 1px solid rgb(51, 103, 153); padding: 0px; text-align: center; font-size: 16px; line-height: 32px; color: rgb(255, 255, 255); font-weight: 400; font-family: \"Open Sans\"; }.tcb-mobile-table [data-css=\"tve-u-17ec54f9f71\"]::before { background-color: rgb(51, 103, 153); border-right: 1px solid rgb(51, 103, 153); padding: 0px; text-align: center; font-size: 16px; line-height: 32px; color: rgb(255, 255, 255); font-weight: 400; font-family: \"Open Sans\"; }.tcb-mobile-table [data-css=\"tve-u-17ec54f9f72\"]::before { background-color: rgb(51, 103, 153); border-right: 1px solid rgb(51, 103, 153); padding: 0px; text-align: center; font-size: 16px; line-height: 32px; color: rgb(255, 255, 255); font-weight: 700; font-family: \"Open Sans\", sans-serif; }.tcb-mobile-table [data-css=\"tve-u-17ec54f9f73\"]::before { background-color: rgb(51, 103, 153); border-right: 1px solid rgb(51, 103, 153); padding: 0px; text-align: center; font-size: 16px; line-height: 32px; color: rgb(255, 255, 255); font-weight: 700; font-family: \"Open Sans\", sans-serif; }.tcb-mobile-table [data-css=\"tve-u-17ec54f9f74\"]::before { background-color: rgb(51, 103, 153); border-right: 1px solid rgb(51, 103, 153); padding: 0px; text-align: center; font-size: 16px; line-height: 32px; color: rgb(255, 255, 255); font-weight: 700; font-family: \"Open Sans\", sans-serif; }.tcb-mobile-table [data-css=\"tve-u-17ec54f9f75\"]::before { background-color: rgb(51, 103, 153); border-right: 1px solid rgb(51, 103, 153); padding: 0px; text-align: center; font-size: 16px; line-height: 32px; color: rgb(255, 255, 255); font-weight: 400; font-family: \"Open Sans\"; }.tcb-mobile-table [data-css=\"tve-u-17ec54f9f76\"]::before { background-color: rgb(51, 103, 153); border-right: 1px solid rgb(51, 103, 153); padding: 0px; text-align: center; font-size: 16px; line-height: 32px; color: rgb(255, 255, 255); font-weight: 700; font-family: \"Open Sans\", sans-serif; }}","tve_user_custom_css":"","tve_globals":{"e":"1","font_cls":[]},"tcb2_ready":1,"tcb_editor_enabled":1,"tve_landing_page":"","_tve_header":"0","_tve_footer":"0"},"categories":[7],"tags":[],"class_list":["post-12640","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-grundlagen"],"_links":{"self":[{"href":"https:\/\/profi-tutorials.de\/linux\/wp-json\/wp\/v2\/posts\/12640","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/profi-tutorials.de\/linux\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/profi-tutorials.de\/linux\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/profi-tutorials.de\/linux\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/profi-tutorials.de\/linux\/wp-json\/wp\/v2\/comments?post=12640"}],"version-history":[{"count":96,"href":"https:\/\/profi-tutorials.de\/linux\/wp-json\/wp\/v2\/posts\/12640\/revisions"}],"predecessor-version":[{"id":12810,"href":"https:\/\/profi-tutorials.de\/linux\/wp-json\/wp\/v2\/posts\/12640\/revisions\/12810"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/profi-tutorials.de\/linux\/wp-json\/wp\/v2\/media\/12643"}],"wp:attachment":[{"href":"https:\/\/profi-tutorials.de\/linux\/wp-json\/wp\/v2\/media?parent=12640"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/profi-tutorials.de\/linux\/wp-json\/wp\/v2\/categories?post=12640"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/profi-tutorials.de\/linux\/wp-json\/wp\/v2\/tags?post=12640"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}