TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Using different delimiters in sed (2010)

59 点作者 navigaid超过 6 年前

7 条评论

teddyh超过 6 年前
The common alternate character, for those cases where normal slashes are not suitable, is a comma character; ‘,’. With Sed code, readability is always an issue, and it can be improved by not using just any character and limiting yourself to as few alternative modes of syntax as possible.<p>With a bit of exposure, commands like<p>s&#x2F;foo&#x2F;bar&#x2F;<p>and<p>s,foo,bar,<p>can be read with equal ease.
评论 #18761583 未加载
评论 #18761792 未加载
评论 #18761975 未加载
评论 #18762945 未加载
devy超过 6 年前
On a related note, I found Bruce Barnett&#x27;s sed tutorial is one of the best Sed guide out there: <a href="http:&#x2F;&#x2F;www.grymoire.com&#x2F;Unix&#x2F;Sed.html" rel="nofollow">http:&#x2F;&#x2F;www.grymoire.com&#x2F;Unix&#x2F;Sed.html</a>
评论 #18763931 未加载
SubiculumCode超过 6 年前
For one offs, I like to change up my delimiter so that I a) remind myslef I can and b)think the slashes are ugly dont like escaping. I prefer pipes.
giobox超过 6 年前
I’ve seen so many hilariously bad workarounds for this in old shell scripts from lazy engineers who apparently can’t read a man page and don’t realise the delimiter character is substitutable with more or less any character you like.<p>This is one of this extremely useful features that a surprisingly large number of users don’t seem to know about.
评论 #18764196 未加载
keyle超过 6 年前
Well, I have some bash scripts to improve... great post, another useful fact on HN.
finnh超过 6 年前
tilda has always been my go-to; in fact i tend to use it in preference to &#x2F; even if there is no literal &#x2F; in my statement.<p>s~foo~bar~<p>I still use &#x2F; when pointing out typos in PRs, tho :)<p>s&#x2F;calulate&#x2F;calculate&#x2F;
chx超过 6 年前
The address one is really useful I wish I knew it this very week. Thanks!