Ich habe eine Textdatei beginnt mit 9 Ziffern College-Code und endet mit 5 Ziffern Kurscode.Merge 2 Zeilen zu einem
512161000 EN5121 K. K. Jorge Institute of Engineering Education and Research, Nashik 61220 Mechanical Engineering [Second Shift] XOPENH 1 116 16978
517261123 EN5172 R. C. Rustom Institute of Technology, Shirpur 61220 Mechanical Engineering [Second Shift] YOPENH 1 100 29555
617561234 EN6175 abc xyz Education Trust, abc xyz College of Engineering,
Pune 61220 Mechanical Engineering [Second Shift] ZOPENH 2 105 25017
Es gibt einige Einträge, bei denen es einen Zeilenumbruch gibt, wie im obigen Beispiel 3 gezeigt. brauche ich wie 1. und 2. Zeile nur 3. und 4. Zeile zu einem verschmelzen, so dass ich leicht Befehl wie grep verwenden können, awk usw.
Update:
Kevins Antwort scheint nicht zu funktionieren.
cat todel.txt
112724510 EN1127 Jagadambha Bahuuddeshiya Gramin Vikas Sanstha's Jagdambha College of,
Engineering and Technology, Yavatmal 24510 Computer Engineering LSCO 1 55 93531
cat todel.txt | perl -ne 'chomp; if (/^\d{9}/) { print "\n$_" } else { print "$_\n" }'
Engineering and Technology, Yavatmal 24510 Computer Engineering LSCO 1 55 93531ege of,
awk '/^[0-9] /,/[0-9]/$' # nicht – shantanuo