Linux

Posted on
Page
of 47
First Prev
/ 47
Next
  • Yeah, I started with Linux in late 1993. 0.9[89]pl?

    Definitely remember MCC distrib based on kernel 1.0.8 whilst at Uni in 1994. 10 floppies (plus more for X?)

  • Before my dabblings. RedHat 5.0 on CD from the Linux Emporium.
    I started just around the tail end of the libc5 to glibc transition I think

  • I think this CD set would have been my first attempt at running Linux.

    Memory's a little hazy, but I think I may have managed to finish some basic installation but couldn't get X running -- then gave up for a few years 'till around 2000.

  • Includes new server for Trident TGUI 9440AGi chipset.

    Handy, since that's what I had

  • I've just found out that I can do this:

     :: tw@desktop1:/home/tw :: 
     $ echo "👍"
    👍
    

    So that's a new thing I can do, and life is now perfect.

  • I tried to get emojis to work in GCC at one point. So you could do all sorts of horrors

    \#define 🌜 {
    \#define 🌛 }
    \#define 👉 (
    \#define 👈 )
    
    typedef int 🤮;
    🤮 😠👉🤮 ✨, 🤮 😎👈
    🌜
       return ✨+😎;
    🌛
    

    Would love to submit one of these in a code review

  • 🌊➕➕
    (sea plus plus)

  • Brainfuck, but written in emojis...

  • So, apparently Windows fast start-up reaaaaally fucks up disk mounts in linux.

    Permissions on folders & files become almost meaningless - whatever shows in ls -a is not what permissions exist.

    Files / directories are randomly corrupted, either showing weird errors, containing nonsense symbols, or, and this is the most frustrating, appear fine, but have a tiny random inconsistent error in the middle somewhere - like a value in column 25 of a million line csv that should have only 3 columns...

    Currently 3 hours into running chkdsk on windows. Only 6 to go...

  • Yeah, leaving loads of metadata in a special undocumented cache breaks the Linux NTFS driver completely.

    Was it really the only way to improve startup time, or was breaking compatibility a goal? Your guess is as good as mine.

  • What grinds my tits most is that it has been fine for a long time.

    Then something happened, and it's all gone belly up just when I really need it not to.

  • Me again. And I've cocked up. Again.

    I was trying to fix a USB problem, which is making it impossible to mount Android devices.

    One of the fixes was to unbind & bind the USB bus devices from the driver.

    In my wisdom, I decided to do all of them in by loopiing through a list.

    I didn't think that I would need to have my mouse & keyboard still connected.

    So I can no longer interact with my desktop at all.

    Any suggestions for a fix? I'm failing at google.

  • Turning off and on again.

    That fixed it.

    After spending an hour working out if I could mount the root partition from a live CD and chroot into it.

  • I tried to get emojis to work in GCC at one point.

    I once wrote a minimalistic wiki which I called μWiki in Java. The package namespace was com.μwiki.... much hilarity.

    My shell prompt at work displays increasingly anxious emoji as a countdown to password expiry

  • I've got this code to extract the first 5 lines of a bunch of semi-colon delimited text file and append the filename to the start of each line.

    awk 'FNR==1,FNR==5 {printf("%s;%s\n",FILENAME,$0)}' *.csv > output.csv
    

    Any suggestions how I get this to scan through sub-directories too to pick up files in there? Cheers

  • Any suggestions how I get this to scan through sub-directories too to pick up files in there?

    Nope, but google might. You could probs adjust this

    https://stackoverflow.com/questions/33049089/using-awk-to-read-and-create-files-in-all-subdirectories

  • I'd probably do something like:-

    for i in `find . -type f -name \*.csv` ; do  awk 'FNR==1,FNR==5 {printf("%s;%s\n",FILENAME,$0)}' $i >> output.csv ; done
    

    or if you wanted it to trash output.csv each time then do:

    for i in `find . -type f -name \*.csv` ; do  awk 'FNR==1,FNR==5 {printf("%s;%s\n",FILENAME,$0)}' $i ; done > output.csv
    

    (Note that both are brittle and won't do the right thing if any filenames contain spaces or other characters such as *, etc. For "normal" filenames it should work fine.)

  • I did lots of this sort of stuff recently - I can dig out what I did & share, but it's broadly the same as @Greenbank, or like this:

    find . -type f -name \*.csv -exec awk 'FNR==1,FNR==5 {printf("%s;%s\n",FILENAME,$0)}' {} \; > output.csv
    

    Some ways are a lot quicker (saving hours in some cases), and I can never remember which: e.g. incrementing in each loop or at the end, using for loops or exec.

    Anyway - Imma have a look.

  • If you know the .csv files are only buried, say, a max of 3 dirs deep then you can just do something like this:-

    awk 'FNR==1,FNR==5 {printf("%s;%s\n",FILENAME,$0)}' *.csv */*.csv */*/*.csv */*/*/*.csv > output.csv
    

    and that avoids a lot of the for/find fuckery.

    (It'll complain to stderr if there are any directories that end in .csv but won't affect the output.)

  • Just wanted to join party:

    grep '' * --recursive -H --max-count=5 --include '*.csv'
    

    Grep can search recursively, and prepend the filename to the matched lines, and limit the number of matches from each file. Combine all that, and you get a solution, only problem is that the filename is followed by a colon:

    subdir/test2.csv:1
    subdir/test2.csv:
    subdir/test2.csv:2
    subdir/test2.csv:3
    subdir/test2.csv:4
    test1.csv:1
    test1.csv:2
    test1.csv:3
    

    so you'd need to replace that...

    grep '' * -r -H -m5 --include '*.csv' | sed 's/:/,/'
    
  • Cheers all. I'll do some testing. The absolute path will definitely have spaces in the name, filenames may but I guess I can eliminate them if necessary.

    Greenhell's slight bodge has done the job for the moment but I should probably do something more robust at some point (I had to remove the first *.csv as there were no csv files in the top folder and that crashed it out before looking at the other folders).

  • If you're willing to install fd (github.com/sharkdp/fd), and you don't care about the order of the output, then:

    fd -t f -e csv -x sed 's/^/{/},/; 5q' {}

    does the trick and is safe to spaces etc in file names.

    If you want the full path name in the output it's trickier because that would have a / in it which will confuse sed.

    Or, with awk, full filename:

    fd -t f -e csv -x awk '{printf("%s,%s\n", FILENAME, $0); FNR == 5 {exit}' {}

    then you could also just use find -type f -name '*.csv' -exec ... instead too.

    Note the exit in the awk command which stops reading the file after 5 lines (so if you have a very long file it doesn't need to read all of it)

  • Microsoft Windows isn’t the main OS for mission-critical systems, that’s Linux – and so this could have been much worse.

    https://www.theguardian.com/business/live/2024/jul/19/retail-sales-great-britain-slump-12-government-borrowing-june-figure-lowest-2019-horizon-business-live?page=with:block-669a74ca8f083fc6a5479c5f#block-669a74ca8f083fc6a5479c5f

    Funny, isn't it--could Linux just be better than Microsoft? :)

  • I'd say "luckier" rather than "better".

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Linux

Posted by Avatar for hael @hael

Actions