像这样的文件:ExampleFile.txt
line1TextHere
line2TextHere
line3TextHere
我想从文件中逐行读取并将其输出到不同的文件,因此文本的每一行都会有一个文件。看起来像这样:
# cat file1.txt
line1TextHere
# cat file2.txt
line2TextHere
# cat file3.txt
line3TextHere
到目前为止我知道,如果我想从示例文件中读取第 2 行,我可以这样做
# awk 'NR==2 {print $0}' ExampleFile.txt
我想我应该用循环读取文件三次,然后将其输出到三个不同的文件,但我不知道该怎么做。我用的是 Debian。谢谢。