(22)
:> f1.txt
:> f2.txt
echo "abcabc11" >> f1.txt
echo "abcabc12" >> f1.txt
echo "abcabc21" >> f2.txt
echo "abcabc22" >> f2.txt
cat f1.txt f2.txt
for i in $(ls -1 f{1,2}.txt) ;do
echo $i
sed -i 's/a/x/g' $i
done
cat f1.txt f2.txt
(11)
:> f1.txt
:> f2.txt
echo "abcabc11" >> f1.txt
echo "abcabc12" >> f1.txt
echo "abcabc21" >> f2.txt
echo "abcabc22" >> f2.txt
cat f1.txt f2.txt
for i in $(ls -1 f{1,2}.txt) ;do
echo $i
sed -i 's/a/x/g' $i
done
cat f1.txt f2.txt
(RL9)
:> f1.txt
:> f2.txt
echo "abcabc11" >> f1.txt
echo "abcabc12" >> f1.txt
echo "abcabc21" >> f2.txt
echo "abcabc22" >> f2.txt
cat f1.txt f2.txt
for i in $(ls -1 f{1,2}.txt) ;do
echo $i
sed -i 's/a/x/g' $i
done
cat f1.txt f2.txt
- Windows Server
(2022)
https://tex2e.github.io/blog/powershell/sed
https://mat0401.info/blog/loop-power-shell/
New-Item -ItemType file f1.txt
New-Item -ItemType file f2.txt
Write-Output "abcabc11" >> f1.txt
Write-Output "abcabc12" >> f1.txt
Write-Output "abcabc21" >> f2.txt
Write-Output "abcabc22" >> f2.txt
Get-Content f?.txt
foreach($i in (Get-Item f?.txt) ){
Write-Host $i
(Get-Content $i) | foreach { $_ -replace "a","x" } | Set-Content $i
}
Get-Content f?.txt