I have many html files named 12345.html, 12346.html, etc. I need to change "style.css" to "style-12345.css" or the corresponding file name. I'm not sure which tool to use, recommendations?
This is pretty easy to do with a for and sed loop:
for i in *.html; do sed -i "s/style\\.css/style-`basename $i .html`.css/g" $i done
The loop executes an internal c command $i, set for each .html file name. sed -imodifies the file in place. basename $i .htmlgets $iwithout a suffix .html(i.e. just a number)
$i
sed -i
basename $i .html
.html
rename. , .
rename
perl /usr/bin/prename, perl . ,
perl
/usr/bin/prename
$ prename 's/foo/bar/ *foo*
"foo" "bar" , "foo".
util-linux /usr/bin/rename, . ,
util-linux
/usr/bin/rename
$ rename foo bar *foo*
, .
prename rename, , .
prename
perl -pi -e 's/style.css/style-12345.css/g' *.html
Source: https://habr.com/ru/post/1750866/More articles:std :: vector same as array [number]? - c ++How to make this regular expression match - htmlМеханика асинхронных потоков - asynchronousImages in TextView - androidMath problem: getting coordinates from position and angle - mathGiving permission to one class - javaChurch digit to add - lambda-calculusС# Когда управляемый поток заканчивает свой срез времени, он будет нести контекстный переключатель? - multithreadingHow to calculate the distance between two GeoPoints with Android MapView - androidhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1750871/what-involves-to-schedule-a-thread-in-windows&usg=ALkJrhjHPm3r6uJwvUi6yziE56z1LyBZZwAll Articles