I have a lot of txt files like this:
Title 1
Text 开发者_JS百科1
And I would like to make one csv file from all of them that it will look like this:
Title 1,Text 1
Title 2,Text 2
Title 3,Text 3
etc
How could I do it using awk?
Without knowing any more detail, the following answers look like good options:
awk '{printf "%s,", $0; getline; print}'
# every second line gets merged with the previous line
or
awk \
'
$0 ~ /^Title/ {printf "\n"}
{printf "%s,", $0}
'
# every line that starts with Title starts
# a newline and the rest is merged into one
# long line separated by commas.
精彩评论