Zeilen auslesen und anderer Stelle wieder einfügen

J

johndoe21

Grünschnabel
Hallo zusammen,

ich habe Problem mit einer Datei, in welcher ich mittels sed Zeilen auslesen will und an anderer Stelle wieder einfügen will.

Ist Zustand "beispiel.txt"

tinput="titel01" toutput="/home/admin/pip/"
tinput="titel02" toutput="/home/admin/pip/"
tinput="titel03" toutput="/home/admin/pip/"
tinput="titel04" toutput="/home/admin/pip/"
tinput="titel05" toutput="/home/admin/pip/"
tinput="titel06" toutput="/home/admin/pip/"
tinput="titel07" toutput="/home/admin/pip/"
tinput="titel08" toutput="/home/admin/pip/"

Soll Zustand "beispiel.txt"

tinput="titel01" toutput="/home/admin/pip/titel01.txt"
tinput="titel02" toutput="/home/admin/pip/titel02.txt"
tinput="titel03" toutput="/home/admin/pip/titel03.txt"
tinput="titel04" toutput="/home/admin/pip/titel04.txt"
tinput="titel05" toutput="/home/admin/pip/titel05.txt"
tinput="titel06" toutput="/home/admin/pip/titel06.txt"
tinput="titel07" toutput="/home/admin/pip/titel07.txt"
tinput="titel08" toutput="/home/admin/pip/titel08.txt"

Ich komme irgendwie nicht weiter in dem ganzen Code Dschungel.

Hat jemand vielleicht einen Ansatz für mich?

Danke Euch
Grüße
Johnny
 
Auf die Gefahr hin mich als Frischling zu outen... :)

Was ich z.B probiert habe

cat beispiel.txt | perl -p -e "s/([a-z]{5}))/\\toutput="/home/admin/pip/\\txt/g"

Ich komme irgendwie nicht weiter. :(
 
cat beispiel.txt | sed 's,tinput="\([^0-9]\)1"\1.txt,g'
cat beispiel.txt | sed 's,\([^0-9]\)1\(\.[^./]*\)$,\1\2,g'
cat beispiel.txt | sed 's,\(tinput="[a-z]"\)1\,\1.txt,g'

Dies auch, aber ich kriege nur eine Ausgabe ohne Veränderung.
 
sed 's_^tinput="\(.*\)" toutput\(.*\)"_tinput="\1" toutput\2\1.txt"_' Beispiel1.txt > Beispiel2.txt
 

Ähnliche Themen

sed - Bitte um Unterstützung

Hilfe für ein shell script

Keine grafische Oberfläche (Debian Installation)

Skript bei Lubuntu nach jedem Start ausführen

2 Zeilen aus einer txt auslesen

Zurück
Oben