小编tac*_*nol的帖子

按行组对文件进行排序

如果我有一个内容类似于以下内容的文件:

FirstSection
    Unique first line in first section
    Unique second line in first section

SecondSection
    Unique first line in second section
    Unique second line in second section

...

NthSection
    Unique first line in Nth section
    Unique second line in Nth section
Run Code Online (Sandbox Code Playgroud)

是否可以使用 unix 命令(例如 sort、awk)按每个三行组中的第一个非缩进行按字母顺序对文件进行排序,同时将缩进行保留在现有组下?

osx freebsd sort

4
推荐指数
1
解决办法
911
查看次数

标签 统计

freebsd ×1

osx ×1

sort ×1