我有一个以 9 位大学代码开头并以 5 位课程代码结尾的文本文件。
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
如上面的 3 示例所示,有一些条目有换行符。我需要将第 3 行和第 4 行合并为一个,就像第 1 行和第 2 行一样,以便我可以轻松地使用 grep、awk 等命令。
更新:
凯文的回答似乎不起作用。
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,