I am having a hard time doing something quite simple. I have around 2000 .txt files which are composed of a single line of digits. I would like to fold the single line into one column with many rows, using the fold command and overwrite the original file with this new, folded version. My attempt:
#!/bin/bash for i in *.txt ; do fold -w 1 $file > $file done
Doesn't work. Help? Thanks.