Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我用这个
head -1 -q *.txt|awk '{print $1}'
它打印文件中内容的第一行。现在如何继续重命名文件?
您可以使用 for 循环:
for fname in *.txt do mv $fname $(head -1 -q $fname|awk '{print $1}') done