如何使用 bash 脚本将一个 txt 文件到另一个 txt 文件的链接放置在特定位置?
我有一个 css 文件,即 1.css
/* CSS variables
Generated by 'wal' */
:root {
** --wallpaper: url("/home/x/.local/share/wallpaper/wall.png");**
/* Special */
--background: #10171d;
--foreground: #daccd3;
--cursor: #daccd3;
我想提取壁纸 url“”中的 url 链接。并想将其放入这个 css 文件中,即
@-moz-document url(about:home), url(about:newtab), url(about:privatebrowsing) {
.click-target-container *, .top-sites-list * {
color: #fff !important ;
text-shadow: 2px 2px 2px #222 !important ;
}
body::before {
content: "" ;
z-index: -1 ;
position: fixed ;
top: 0 ;
left: 0 ;
**background: #f9a no-repeat url("want to put that link here") center ;**
background-size: cover ;
width: 100vw ;
height: 100vh ;
}
}
我希望链接位于第二个 css 文件的后台 url 中,
我尝试了一些命令
awk 'NR==4 { print $2 }' colors.css > 1.txt
cat '1,txt' |sed 's/;.*//' > 2.txt
来从第一个文件中提取链接。但我不知道如何将该链接导入到第二个 css 文件的确切位置
I have a css file which is this 1.css
/* CSS variables
Generated by 'wal' */
:root {
** --wallpaper: url("/home/x/.local/share/wallpaper/wall.png");**
/* Special */
--background: #10171d;
--foreground: #daccd3;
--cursor: #daccd3;
I want to extract that url link which is in wallpaper url " ". and want to put it in this css file which is this
@-moz-document url(about:home), url(about:newtab), url(about:privatebrowsing) {
.click-target-container *, .top-sites-list * {
color: #fff !important ;
text-shadow: 2px 2px 2px #222 !important ;
}
body::before {
content: "" ;
z-index: -1 ;
position: fixed ;
top: 0 ;
left: 0 ;
**background: #f9a no-repeat url("want to put that link here") center ;**
background-size: cover ;
width: 100vw ;
height: 100vh ;
}
}
I want the link to be in background url of the 2nd css file
I tried some of this commands
awk 'NR==4 { print $2 }' colors.css > 1.txt
cat '1,txt' |sed 's/;.*//' > 2.txt
to extract the link from first file. But I don't know how to import that link to the 2nd css file at the exact place
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将
awk
结果放入变量中。然后在 sed 中使用该变量来更新 CSS 文件。%
参数扩展运算符可用于删除$url
中尾随的;
。Put the
awk
result in a variable. Then use that variable insed
to update the CSS file.The
%
parameter expansion operator can be used to remove the trailing;
in$url
.