在linux中用给定的字符串对文件进行排序

时间:2017-06-05 06:31:49

标签: linux

我想用给定的字符串对文件行进行排序,例如:

"104~Rahul~<td bgcolor=GREEN>Loaded Fine</td>~<td bgcolor=GREEN>Loaded 
Fine</td>~<td></td>~<td></td>~Customer_files_are_loading_by_DMS_Team
104~Rahul_DWA~<td bgcolor=GREEN>Loaded Fine</td>~<td bgcolor=GREEN>Loaded 
Fine</td>~<td></td>~<td></td>~Customer_files_are_loading_by_DMS_Team
104~Rahul_SFI~<td bgcolor=GREEN>Loaded Fine</td>~<td bgcolor=GREEN>Loaded 
Fine</td>~<td></td>~<td></td>~Customer_files_are_loading_by_DMS_Team
104~Rahul_SFI~<td bgcolor=GREEN>Loaded Fine</td>~<td bgcolor=GREEN>Loaded 
Fine</td>~<td></td>~<td></td>~Customer_files_are_loading_by_DMS_Team
15014~JVCanada~<td bgcolor=GREEN>Loaded Fine</td>~<td></td>~<td 
bgcolor=GREEN>Loaded Fine</td>~<td bgcolor=GREEN>Loaded 
Fine</td>~We_are_not_receiving_Cleared_file
10148~Kedar~<td bgcolor=GREEN>Loaded Fine</td>~<td bgcolor=RED>Not loaded</td>~<td bgcolor=RED>Not loaded</td>~<td></td>~NA
70169~Kedar~<td bgcolor=GREEN>Loaded Fine</td>~<td bgcolor=RED>Not loaded</td>~<td></td>~<td></td>~NA"

字符串应该是“如果它未加载”,则应首先显示该行,然后是“

1 个答案:

答案 0 :(得分:0)

尝试在一行中运行这些:

grep 'Not loaded' file; grep -v 'Not loaded' file