It’s censored because censoring it is an automatic 4 comments of free engagement to boost you in the algorithms of various platforms.
- 0 Posts
- 75 Comments
bus_factor@lemmy.worldto
Linux@lemmy.ml•How to selectively install Desktop Environments apps ?
1·5 months agoIf you just run the command you ran initially it will print out the packages it wants to pull in. You can then cancel it and install whichever subset you choose manually.
bus_factor@lemmy.worldto
Mildly Infuriating@lemmy.world•Capitalism indoctrination in progress.English
1·5 months agoJust don’t promise a pizza party and fail to deliver! That happened at my job once, and people did not like it.
bus_factor@lemmy.worldto
Mildly Infuriating@lemmy.world•Capitalism indoctrination in progress.English
1·5 months agoEither of those within earshot from my desk and I’m not taking the job.
bus_factor@lemmy.worldto
Linux@lemmy.ml•Looking for Complex Text Manipulation CLI tools
1·6 months agoWe’re talking about different halves. The regex
\w+\s+matches "The " (“The” followed by a space), not “The MCU”.
bus_factor@lemmy.worldto
Linux@lemmy.ml•Looking for Complex Text Manipulation CLI tools
1·6 months agoWhy do we replace the commas again with new lines?
Consider this two-line output:
$ echo 'a\nb' a b $We convert the newlines to commas. Now there is a comma at the end of the last line as well, and because of no newline, the next prompt is at the end of the output:
$ echo 'a\nb' | tr '\n' , a,b,$Substituting only the last comma (
means end of line) allows us to get the output we expected:$ echo 'a\nb' | tr '\n' , | sed 's/,$/\n/' a,b $Or is there a way to combine them
These two commands have equivalent output:
tr '\n' ',' | tr ';' ',' tr '\n;' ',,'What tr does is take a list of characters in parameter 1 and converts them to the equivalent position character in parameter 2. There’s a little more to it (it supports ranges, for example), but this will do the job. To learn more you can run
man trto get the documentation for it.I tried
What \w+\s+ Says About\w+\s+matches "at least one word character and then at least one whitespace character, and that’s not what you want. “The MCU” is one or more word characters, then a space, and then one or more word characters again, and that second part you’re not matching at all. In this case, you’re probably better off making a negative matching group where you make sure you don’t match across separators.What [^,;]+ Says Aboutwould match anything that’s not a comma or semicolon, for instance.The other problem with regex is that every implementation does things differently. For example, sed would interpret that plus as a literal
+, so for sed syntax you’d need to use\+instead. It also does not support\wand\s, and whether to use(or\(for a literal parenthesis also varies between implementations. I often switch to Perl if I need to do some more complex regex shenanigans.
bus_factor@lemmy.worldto
Linux@lemmy.ml•Looking for Complex Text Manipulation CLI tools
2·6 months agoIf you can’t install a dedicated tool like
yqbut don’t mind creating a standalone script, python would be able to do this out of the box on pretty much any computer, calculator or toaster you can get your hands on in 2026:#! /usr/bin/env python3 import yaml import sys def parse_yaml(filename): with open(filename) as fd: return yaml.safe_load(fd) def get_leaf_nodes(data_iterable): output = [] for v in data_iterable: if isinstance(v, dict): output += get_leaf_nodes(v.values()) elif isinstance(v, list): output += get_leaf_nodes(v) else: output.append(v) return output print(",".join(get_leaf_nodes(parse_yaml(sys.argv[1]))))$ /tmp/foo.py /tmp/foo.txt Harry potter,Perfect Blue,Jurassic world,Jurassic Park,Jedi,Star wars,The clone wars,MCU,Gumball,Flapjack,Steven Universe,Stars vs. the forces of Evil,Wordgril,FlapjackThis takes the first argument on the command line, parses it as yaml, finds all leaf nodes recursively, and prints a comma-separated list of the results.
bus_factor@lemmy.worldto
Linux@lemmy.ml•Looking for Complex Text Manipulation CLI tools
1·6 months agoIf you’re feeling a little old school (and some might say masochistic), you could so a similar crude parser with a perl oneliner. This would be more efficient compute wise, but it’s a bit of an acquired taste readability wise:
$ perl -ne 'chomp; push @a, $1 if /^\s*-\s*(.*[^:\s])\s*$/; END{print join(",", @a), "\n"}' /tmp/foo.txt Harry potter,Perfect Blue,Jurassic world,Jurassic Park,Jedi,Star wars,The clone wars,MCU,Gumball,Flapjack,Steven Universe,Stars vs. the forces of Evil,Wordgril,FlapjackHere
perl -nmakes perl look at each line individually,chompstrips off the trailing newline, we match for/^\s*-\s*(.*[^:\s])\s*$/(a string starting with a dash and ending with something not a colon) and append the content of the matching parenthesis to an implicitly declared array@a. Then we add anEND{}block which will be executed after all lines are parsed, where we print the array joined on,.
bus_factor@lemmy.worldto
Linux@lemmy.ml•Looking for Complex Text Manipulation CLI tools
3·6 months agoIf you wanted a somewhat cruder approach using basically ubiquitous tools, you could do something like this:
$ grep '^ *-' /tmp/foo.txt | grep -v ': *$' | sed 's/ *- //' | tr '\n' ',' | sed s'/,$/\n/' Harry potter,Perfect Blue,Jurassic world,Jurassic Park,Jedi,Star wars,The clone wars,MCU,Gumball ,Flapjack,Steven Universe,Stars vs. the forces of Evil,Wordgril,FlapjackHere I’m first using
grep '^ *-'to get all lines starting with any amount of whitespace and a leading dash, then piping that togrep -v ': *$'to remove anything with a colon at the end (including those with whitespace after the colon), then usingtr '\n' ','to replace all newlines with commas, and thensed s'/,$/\n/'to replace the trailing comma with a newline again (although sed is finicky across platforms wrt newlines, so you may want to just replace it with an empty string instead).The above is hardly an efficient approach, but it does the job.
bus_factor@lemmy.worldto
Linux@lemmy.ml•Looking for Complex Text Manipulation CLI tools
1·6 months agoIf you can stick to valid YAML like your example is, you can use a reasonably short
yqcommand to get a comma-separated string of all scalar values:$ yq -r '[.. | scalars] | join(",")' /tmp/foo.txt Harry potter,Perfect Blue,Jurassic world,Jurassic Park,Jedi,Star wars,The clone wars,MCU,Gumball,Flapjack,Steven Universe,Stars vs. the forces of Evil,Wordgril,Flapjack..goes down the tree recursively,scalarsfilters out only scalar values,[]around those two makes them an array, and piping it all tojoin(",")makes it into a comma-separated string.
bus_factor@lemmy.worldto
Linux@lemmy.ml•Looking for Complex Text Manipulation CLI tools
6·6 months agoYour description is too vague to really get a good answer. In general, if you’re doing complex string manipulation, you’ll use a full-fledged programming language with regex support, like Python, Perl or Awk, possibly piped into each other and/or other tools like Sed or Cut. I can’t be more specific than that without a more specific description where you describe the actual data and criteria.
Are you starting with the first or second example? Why do the prefix numbers change between examples? How do you tell text and title/subtitle apart?
Depends entirely on your distro. Some distros, within weeks, other distros will take up to a few years. Just depends on whether your distro prioritizes bleeding edge or stability.
bus_factor@lemmy.worldto
Linux@lemmy.ml•Need help setting up a software RAID 1 through Calamares Installer (Debian 13 Trixie)
31·7 months ago/dev/md127is probably a raid 1 from a previous installation. Assuming you don’t need the data on it, you can either delete or ignore it.I’m not familiar with this exact installer, but I have installed Debian a bunch before. Judging by what I’m seeing here, you probably need to do a bit of manual labor. I’m guessing you first create partition tables (usually gpt), then raid partitions, then combine them into a raid, and maybe then put lvm on top of that again, and finally a filesystem. If you’re planning to go the lvm route you probably want to create a smaller raid on the start of the disk for
/boot(250-500MB should suffice) separate from the lvm, because last I checked you can’t boot from an lvm volume.
bus_factor@lemmy.worldto
Selfhosted@lemmy.world•My 2025 open source journey - what a year!English
4·7 months agoSorry to hear about your kid, and I hope they get better! I don’t watch TV or play video games either, but right now my wife and kids consume the bulk of my free time. Not that it would matter, I’d never get to your release frequency if I was single either.
I’m more of a “refactor it 90 times before I deem it worthy and then spend some more time failing to come up with a name” kind of guy. I’m pretty good at working with legacy codebases, though, so most of my OSS contributions are patches to existing projects. That’s also easier to cram into my schedule.
bus_factor@lemmy.worldto
Selfhosted@lemmy.world•My 2025 open source journey - what a year!English
7·7 months agoHoly smokes, you did all that in one year? Alone? Do you just write open source projects full time, or do you also have a day job on top of all that?
Person of the Year is not an endorsement of their practices, it’s really just whoever dominated the news cycle that year. Both Hitler and Stalin have been Person of the Year. Sometimes it’s not even people, like “The Computer” in 1982.
bus_factor@lemmy.worldto
Selfhosted@lemmy.world•Self hosted Kanban board with good mobile supportEnglish
6·7 months agoPretty sure Trello was bought by Atlassian?
bus_factor@lemmy.worldto
Linux@lemmy.ml•So close yet so far. Why must hardware support be so weird?
2·8 months agoI’m guessing the old CPU was simply defective, and they needed to replace it to install any os.
bus_factor@lemmy.worldto
Linux@lemmy.ml•Linux is awesome at home, but aren't y'all forced to use Windows at work?
52·8 months agoI never heard of that, and I doubt it happened. Apple won’t touch anything with a GPL license.

Our car is white because that’s what they had in stock when we needed a car. I don’t give a shit what color my car is as long as it can fit and move my family and my stuff.