GPT means Generative Pre-trained Transformer
It’s been the buzz since Fall 2022, and AI is slowly creeping in our lives. I have even used ChatGPT a few times to ask questions on Python code or regular expression usage with sed
.
This 18min YouTube video “The AI wars: Google vs Bing (ChatGPT)” mentions 2 other AI “GPT” sites:
. You.com: The AI Search Engine You Control
. open-assistant.io: Conversational AI for everyone (site for data collection, not answers. See details at https://github.com/LAION-AI/Open-Assistant)
I had asked ChatGPT the following question:
Can you explain in plain English the strem editor and regular expression that follows: sed 's/(.)/\1\n/g'
The ChatGPT answer was 1/2 page long and correctly explained. The You.Com answer was a lot more complicated even though it provided a lot of interesting information, with some added sarcasm! It first said: “It’s a bad example; you shouldn’t follow it.” But then it provided a long tirade on how it actually works, even though the style was not as “smooth” as that of ChatGPT.
But I learned a new word: “sigil” which was use to describe the /
separator, then indicating that any character can be used as a sigil, providing an example using @
instead: `
sed -e 's@^[.]/@@g'
One of the sarcastic comment was about the /
separator (sigil) that has to be escaped as \/
because the symbol is used both as a sigil and as a character in the formulaes. Here is the verbatim sarcasm given by you.com:
Any character can be used as a sigil, and the person who chose to use
/
for this expression was, to be charitable, not thinking about what they were doing very hard).
In explaining the trailing g
in the command (which I always assumed meant “global” so that all matches are changed, not just the first one – which is true within vi
or vim
) You.com wrote (I add italics to highlight…)
g
in theflags
section indicates that more than one replacement can happen each line. In conjunction with^
, this has no meaning, since there can only be one beginning-of-the-line per line; further evidence that the person who wrote your example wasn’t thinking much.
It seems that these answers are rehashed from sites like Stack Overflow, even though I cannot find the original with Google. The first answer was:
Asked Jun 11, 2015 • -2 votes 2 answers
I’m studying Bash programming and I find this example but I don’t understand what it means: In particular the argument passed tosed
after ‘-e’.
filtered_files=`echo "$files" | sed -e 's/^\.\///g'`
The origin of the answer remains elusive.