Wikipedia:Reference desk/Archives/Computing/2022 June 24

= June 24 =

sed n00b
In zsh, I want to remove a string from each of a set of files. I tried this

for u in `grep -l "$1" *filetype` do  sed -e "1,$s/$1//" -i "" $u done

but oops, the argument strings are usually URLs (or parts of URLs) and so they usually contain slashes, which confuse sed. (I had never tried using sed before.) Suggestions? —Tamfang (talk) 01:51, 24 June 2022 (UTC)


 * sed doesn't require you to use / as delimiter. It will use whatever character you put after the s:
 * sed s#some/url#replacement#
 * PiusImpavidus (talk) 09:21, 24 June 2022 (UTC)


 * Note, however, that the 1,$ part [1] isn't necessary, since sed's default is to act on all lines, and [2] won't work, because zsh will see the characters "$s" as asking for the shell variable s to be interpolated. In this case you need only delete the 1,$ part. --174.95.82.222 (talk) 00:47, 25 June 2022 (UTC)

Thanks, it works now. for u in `grep -li "$1" *k` do     sed -e "s'$1''" -i "" $u done —Tamfang (talk) 01:29, 28 June 2022 (UTC)

What does the "np-" prefix in worldcat directory mean?
Hi. The identity pages of WorldCat use LCCN or VIAF as prefixes in the URLs. It obviously implies that those identity numbers are from LCCN or VIAF authority control system. But there is also "np-". What does it mean or which authority control system does it belong to?--虹易 (talk) 03:38, 24 June 2022 (UTC)


 * Those all have the name in the URL, rather than the number. Here's a clue: "To retrieve the Identity for people that do not have an LCCN, you reference them directly". Slide 8 of this Powerpoint uses the term "NameParts", so that's a possible meaning for np-. Card Zero  (talk) 12:17, 24 June 2022 (UTC)
 * "(Exact)NameParts" is plausible. Another, wild guess: "No Prefix" – like the self-contradictory "This page intentionally left blank". --Lambiam 13:16, 24 June 2022 (UTC)
 * To find J. S. Bach, you can use these:
 * https://www.worldcat.org/identities/lccn-n79-21425/
 * https://www.worldcat.org/identities/np-bach,+johann+sebastian/
 * But, curiously, these are different records that do not appear to cross-reference each other. Either sports a long list of "Most widely held works about Johann Sebastian Bach"; these two lists appear to have no overlap. And if you use
 * https://www.worldcat.org/identities/np-johann+sebastian+bach/,
 * WorldCat assumes you speak Chinese. --Lambiam 15:15, 24 June 2022 (UTC)
 * If you look at works by Johann Sebastian Bach, it gives the number of libraries holding each work, which is an order of magnitude larger in the case of LCCN. This is telling us something embarrassing about how library catalogs (barely) work, I think. Different librarians edit the records in their own idiosyncratic ways. Possibly once a work by Johann Sebastian Bach has been associated with lccn-n79-21425 somewhere, that trumps all the other libraries where it was just plain Johann Sebastian Bach, but the more obscure works haven't been given identity numbers by anyone anywhere, yet, so they appear on the second list. Also of course we write surname first, so a catalog entry "Johann Sebastian Bach" refers to a person called Sebastian with middle name Bach, last name Johann: and thus most of these works are in Chinese (1 edition held in 1 library) because something something Chinese name order [explanation missing]. I claim that we write surname first, but in practical reality we forget to do this maybe 0.5% of the time, hence there are some English and German works mixed in.
 * I don't really know how these identity numbers are assigned, though, or by who, and I'm making some big assumptions. What if librarians assign their local copies of the same work to different authors (with the same name, but different identity numbers)? How does WorldCat choose one? Who creates the first instance of an identity number, and what prevents somebody else negligently creating a different number for the same person?
 * Oh, WorldCat is one giant shared database, so that answers the first question, but not the second. It would be just like a proposed page merge situation on Wikipedia. This might in fact be what's going on with all the Bachs. Card Zero  (talk) 16:21, 24 June 2022 (UTC)

How to stop Edge from adding "Check this out - "?
Is there a way to stop Microsoft Edge from pre-pending "Check this out –" when I share an article from Edge? Currently, I manually delete this text, but it would be nice if there's a way to stop Edge from inserting this all the time. AnonComputerGuy (talk) 19:44, 24 June 2022 (UTC)


 * It looks like there aren't many Edge users here, unsurprisingly. Micro$oft have numerous user forums where you are more likely to get an answer. Shantavira|feed me 07:13, 1 July 2022 (UTC)