orsetto

joined 2 years ago
[–] orsetto@lemmy.dbzer0.com 2 points 2 weeks ago

Oh yeah i figured there were some tools able to do that, i meant to say that you can't substitute one with the other in place without doing some sort of conversion.

[–] orsetto@lemmy.dbzer0.com 2 points 2 weeks ago

sorry for the late reply. I honestly do not remember what the procedure is. The best thing you can do is look on the internet for a easy to follow guide, or wait for someone else's response

[–] orsetto@lemmy.dbzer0.com 10 points 2 weeks ago (4 children)

Unfortunately changing from MBR to GPT also deletes existing partitions and partition table, because the two are not compatible.

Luckily, testdisk should be able to recover the old partition table without much fuss, if you didn't write other data to the disk.

I don't have a manual handy but the man page from what i remember is pretty clear, and there's also an online documentation.

[–] orsetto@lemmy.dbzer0.com 12 points 1 month ago

And all that just because someone decided that an array bigger that 16 bytes would have been too expensive (/s probably)

[–] orsetto@lemmy.dbzer0.com 35 points 1 month ago (2 children)

I'm almost sure the backstory to how you gained this knowledge is "i spent hours debugging something, and that 15 chars limit was the problem"

[–] orsetto@lemmy.dbzer0.com 2 points 1 month ago (4 children)

I might be a robot, I don't know why but i can't solve the captcha lol

I'd love to give this a try tho so maybe I'll come back later

Just a random idea, but would you consider using anubis instead? (That new thingy that has been popping up lately, for example on the archwiki). I haven't checked it out but I bet it's also better on a privacy standpoint in respect to google's captcha

[–] orsetto@lemmy.dbzer0.com 2 points 2 months ago (1 children)

There’s no shame in combining multiple tools, that’s what pipelines are all about

Not at all, but some times it's just funny

You can select specific lines, with regex or by using a line number; or you can select multiple lines by using a comma to specify a range.

Yep, learning this made sed even more useful to me.

I also gave awk a try and now i know what i've missed all these years

(Also, sorry for the 12 days old reply :))

[–] orsetto@lemmy.dbzer0.com 2 points 2 months ago

12 days late, but thanks for the bit of history, I always enjoy this stuff :)

[–] orsetto@lemmy.dbzer0.com 13 points 2 months ago (8 children)

I understand what argument could be made against musl, which is licensed under MIT, but what's wrong with GPLv2?

I remember Torvald saying something about not wanting to change the kernel's license to GPLv3, but I've never understood the differences

[–] orsetto@lemmy.dbzer0.com 3 points 2 months ago (2 children)

Are you opposed to using awk?

Not at all, I'm just not familiar with it so I find it confusing.

Although, looking at your command, i think I understand what it means

[–] orsetto@lemmy.dbzer0.com 2 points 2 months ago (2 children)

I see. I guess what confused me was that i didn't understand what addresses were.

Thank you for your explanations :)

22
Help with sed commands (lemmy.dbzer0.com)
submitted 2 months ago* (last edited 2 months ago) by orsetto@lemmy.dbzer0.com to c/linux@lemmy.ml
 

Hi all! I have always only used sed with s///, becouse I've never been able to figure out how to properly make use of its full capabilities. Right now, I'm trying to filter the output of df -h --output=avail,source to only get the available space from /dev/dm-2 (let's ignore that I just realized df accepts a device as parameter, which clearly solves my problem).

This is the command I'm using, which works:

df -h --output=avail,source \
    | grep /dev/dm-2 \
    | sed -E 's/^[[:blank:]]*([0-9]+(G|M|K)).*$/\1/

However, it makes use of grep, and I'd like to get rid of it. So I've tried with a combiantion of t, T, //d and some other stuff, but onestly the output I get makes no sense to me, and I can't figure out what I should do instead.

In short, my question is: given the following output

$ df -h --output=avail,source 
Avail Filesystem
  87G /dev/dm-2
 1.6G tmpfs
  61K efivarfs
  10M dev
...

How do I only get 87G using only sed as a filter?

EDIT:

Nevermind, I've figured it out...

$ df -h --output=avail,source \
    | sed -E 's/^[[:blank:]]*([0-9]+(G|M|K))[[:blank:]]+(\/dev\/dm-2).*$/\1/; t; /.*/d'
85G
view more: next ›