Here is a shell script to find all txt files and add string “my_begin” to the beginning of files.
You can change the string for your target.

set -e
folder="./"
files=()
echo "start to find txt under folder: "$folder
find $folder -name  "*.txt" -print0 >tmpfile
while IFS=  read -r -d $'\0'; do
    files+=("$REPLY")
done < tmpfile

len=${#files[*]}
echo ${files[@]} #print all
echo "----- length is "${len}

#exit 0

for (( i=0; i<${len}; i++ ))
do
    echo "input file: " ${files[$i]}
    filename=${files[$i]}
    x=`echo -n "my_begin"; cat "${filename}"`
    echo "$x" > "$filename"
done

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments

Tex To PDF
: convert the Latex file which suffix is tex to a PDF file

X
0
Would love your thoughts, please comment.x
()
x