I have 1000 files with txt format, I want to
I want to replace the first line of each file which is "PUT KEYWORDS HERE" with my keywords which is "XYZ LET DDMIN=0.0 SCFCRT=1.D-10"
any idea
I have 1000 files with txt format, I want to
I want to replace the first line of each file which is "PUT KEYWORDS HERE" with my keywords which is "XYZ LET DDMIN=0.0 SCFCRT=1.D-10"
any idea
Try this
#!/bin/bash
files=$(ls -lA ./path | grep -v "total" | awk {'print $NF'})
for file in ${files[*]}
do
sed -i -e '1s/PUT KEYWORDS HERE/XYZ LET DDMIN=0.0 SCFCRT=1.D-10/' ./path/$file
done