Как разрешить пользователям общий доступ к файлам?

Если я правильно понял, вы хотите сделать две вещи:

  1. Замените #5c616cна url(#grad1).
  2. Вставить эти строки после открывающего <svg...>тега:

    <linearGradient id="grad1" x1="0%" y1="0%" x2="100%" y2="0%">
      <stop offset="0%" style="stop-color:rgb(255,255,0);stop-opacity:1" />
      <stop offset="100%" style="stop-color:rgb(255,0,0);stop-opacity:1" />
    </linearGradient>
    

Лично я бы сделал все на Perl:

#!/bin/perl
my $replacement=<<EoF;
<linearGradient id="grad1" x1="0%" y1="0%" x2="100%" y2="0%">
  <stop offset="0%" style="stop-color:rgb(255,255,0);stop-opacity:1" />
  <stop offset="100%" style="stop-color:rgb(255,0,0);stop-opacity:1" />
</linearGradient>
EoF
## This is just to fix SE's syntax highlighting /    
my $foundSvg = 0;
while (<>) {
  ## Insert the replacement after the 1st line matching '<svg'
  if (/<\s*svg/) {
    $foundSvg++;
  }
  if ($foundSvg == 1) {
    ## $_ is the value of the current line. If we have found the <svg,
    ## append $replacement to this line
    $_.= $replacement;
    ## Increment $foundSvg so we don't do this twice
    $foundSvg++;
  }
  ## For all lines, replace all occurrences of #5c616c with url(#grad1)
  s/#5c616c/url(#grad1)/g;
  ## Print the line
  print;
}

Сохраните это как foo.pl, а затем:

for f in *svg; do
   perl foo.pl "$f" > tmpFile && mv tmpFile "$f"
done
0
05.03.2021, 17:56
1 ответ

На вашем месте я бы использовал что-то вроде этого:https://en.wikipedia.org/wiki/List_of_collaborative_software#Web-based_software

Управление группами, пользователями и файлами может быстро превратиться в рутинную работу, не говоря уже о том, что это сопряжено с рисками для безопасности и другими сложностями.

0
18.03.2021, 22:27

Теги

Похожие вопросы