我有一个看起来像这样的CSV文件
AS2345,ASDF1232, Mr. Plain Example, 110 Binary ave.,Atlantis,RI,12345,(999)123-5555,1.56 AS2345,ASDF1232, Mrs. Plain Example, 1121110 Ternary st. 110 Binary ave..,Atlantis,RI,12345,(999)123-5555,1.56 AS2345,ASDF1232, Mr. Plain Example, 110 Binary ave.,Liberty City,RI,12345,(999)123-5555,1.56 AS2345,ASDF1232, Mr. Plain Example, 110 Ternary ave.,Some City,RI,12345,(999)123-5555,1.56
我需要按行长度排序,包括空格.以下命令不包含空格,有没有办法修改它以便它对我有用?
cat $@ | awk '{ print length, $0 }' | sort -n | awk '{$1=""; print $0}'
Run Code Online (Sandbox Code Playgroud) 与从最长到最短的排序行类似,如何将文件中的所有行从最短到最长排序?例如"
This is a long sentence. This is not so long. This is not long.
那就变成:
This is not long. This is not so long. This is a long sentence.