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

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -