regex - Combined Text Files With a Delimiter to One line -
i'm looking combined multiple text files delimiter , file name erase of new lines , have on 1 line.
so far can 2 different scripts:
find -type f -name '*.txt' -print | while read filename; echo "±±±±± $filename"; cat "$filename"; done > files.txt; and
tr '\n' ' ' < files.txt > desiredoutput.txt i've tried combining these 2 no avail. suggestions?
the simplest way combine them tr on each $filename in place of cat:
find -type f -name '*.txt' -print | while read filename echo -n "±±±±± $filename " # -n suppresses \n @ end of line. tr '\n' ' ' < "$filename" echo -n ' ' # add terminating delimiter done > desiredoutput.txt;
Comments
Post a Comment