入力ファイル:
ファイル: Article1.txt:
paragraph1 It is a long established fact that a reader will......
paragraph2 It is a long established fact that a reader will......
paragraph3 It is a long established fact that a reader will......
ファイル: Article2.txt:
It is a long established fact that a reader will......
It is a long established fact that a reader will......
It is a long established fact that a reader will......
ファイル: Article3.txt:
Lorem Ipsum is simply dummy text of the printing.......
Lorem Ipsum is simply dummy text of the printing......
Lorem Ipsum is simply dummy text of the printing.......
希望の出力:
ファイル: example.csv:
column1 column2 column3
Article1 paragraph1 It is a...... paragraph2 It is a.......
Article2 paragraph1 It is a...... paragraph2 It is a.......
Article3 Lorem I....... Lorem I.......
ベストアンサー1
ただ奇妙な推測だけです。
awk 'BEGINFILE { printf "%s",FILENAME}
{ printf ",%s",$0 ;}
ENDFILE { printf "\n" ;}' file1.txt file2.txt file3.txt
これにより、ファイルはcsv(引用符を除く)に変換され、ファイルは1行に変換されます。
",%s"
タブを使って交換します"\t%s"
。