我需要写一个wc完全模仿linux命令的perl(包括尤其是输出格式),在实现功能的同时,输出wc真的很头疼,似乎一直在变化,以下是几个例子(我将使用 □ 表示空格字符)
1. wc test_input_1⇒ □□705673□□4234032□26754553□test_input_1
2. wc test_input_2⇒ □14□□79□581□test_input_2
3. wc test_input_2 -w⇒ 79□test_input_2
4. wc test_input_2 -wc⇒ □79□581□test_input_2
5. cat test_input_2 | wc⇒ □□□□□14□□□□□□79□□□□□581
6. cat test_input_2 | wc -w⇒ 79
7. cat test_input_2 | wc -wc⇒□□□□□79□□□□□581
有谁知道 wc 如何格式化其输出?任何帮助表示赞赏,非常感谢。