I want to apply this sed command
sed \'/begin 644/,$d\' file1.txt > file1.txt
to all files of the directory.. basically I want to keep the h
You can use this find with sed:
find
sed
find . -maxdepth 1 -name '*.txt' -exec sed -i.bak '/begin 644/,$d' {} +
Or if you want to keep begin 644:
begin 644
find . -maxdepth 1 -name '*.txt' -exec sed -i.bak -n '1,/begin 644/p' {} +