Well busybox just sucked even more, if that was possible

Damn!

Debian “derived” versions of busybox don’t have vi / vim - e.g. you’re FORCED at gunpoint :slight_smile: , in a rescue session, to use nano instead (e.g. to comment out a dodgy mount in /etc/fstab, or foobar’d GRUB entry or whatever - frankly I’d rather grapple with the vagaries of regex in sed than use nano).

And - I’m going to assume MobaXterm’s shittyness of foisting essential commands like “cat” on users via the busybox version (that DOES NOT have the display line numbers feature (e.g. “cat -n textfile”)), maybe also comes from Debian’s more sucky (Red Hat busybox has vi!) version of busybox.

MobaXterm… I paid for this SHIT and they expect me to use the hamstrung busybox version of “cat”?

I just googled (yes I use google) for workarounds, and there doesn’t seem to be any, i.e. to

cat -n filename
(to display line numbers at the start of each line)… I guess I need to now write an EFFING for loop and increment it on each iteration of cat for the given filename?

export SEED=1 ; for SHIT in $(cat filename) ; do echo $SEED $SHIT ; SEED=$((SEED+1)) ; done

Look at this UGLINESS :

  09/01/2023   10:50.40   /home/mobaxterm  cat --help
BusyBox v1.22.1 (2015-11-10 11:07:12    ) multi-call binary.

Usage: cat [FILE]...

Concatenate FILEs and print them to stdout

That’s it - there are NO arguments or command line switches! FU busybox!

What a bunch of wankers at MobaTek - couldn’t they chuck in the proper GNU “cat” command instead? The product I paid for is “MobaXterm Professional” - my arse professional…

One of these days I’m gonna give up on it and try and do cygwin myself, from scratch…

Here’s what I’m trying to do - cat a CSV file and prefex each line in the output, with a number, the filename is : “shonky-shit-show-sheet.csv”

Ordinarily :
cat -n shonky-shit-show-sheet.csv
would work - but NOT with busybox - instead I have to :
export IFS=$(echo -en "\n\b") ; export SEED=1 ; for SHIT in $(cat shonky-shit-show-sheet.csv) ; do echo $SEED $SHIT ; SEED=$((SEED+1)) ; done

How EFFING cumbersome is that?

Yeah - I like to swear, a lot :slight_smile: - and I just realised that’s quite a tongue twister, she sells seashells etc…

1 Like

awk (print NR, $0) filename
but this Mobo rubbish may not have awk either

It may have nl

$ cat > junk
a
b
c
$ nl junk
     1  a
     2  b
     3  c
1 Like

Damn!

I’d forgotten about “nl” I was only using it a couple of weeks ago! Doh!

MobaXterm does have awk (and sed) and neither is rolled into busybox - they’re standalone (or at least I think so)… I don’t know why MobaXterm opts for busybox - stupid decision anyway…

Are you sure that awk syntax is correct? Tried that - and various combos with curly braces too…


Doh!

“awk” in MobaXterm is also part of busybox!

  09/01/2023   13:19.07   /home/mobaxterm  which awk
/bin/awk
                                                                                                                                                                                                           ✔

  09/01/2023   13:19.50   /home/mobaxterm  awk --help
BusyBox v1.22.1 (2015-11-10 11:07:12    ) multi-call binary.

Usage: awk [OPTIONS] [AWK_PROGRAM] [FILE]...

        -v VAR=VAL      Set variable
        -F SEP          Use SEP as field separator
        -f FILE         Read program from FILE
        -e AWK_PROGRAM

Sorry , forgot the quotes, and it is braces

nevj@trinity ~ $ awk '{print NR,$0}' gentoo.note
1 The gentoo minimal install cd is
2 install-amd64-minimal-20220703T170542Z.iso

There you are, tested

1 Like

How about grep?

$ grep -n ".*" check-uname-a.sh
1:uname -a >> uname-a.txt
2:uniq uname-a.txt > uname-a.tmp
3:cp uname-a.tmp uname-a.txt
4:rm uname-a.tmp
5:clear
6:cat uname-a.txt | ccze -A
2 Likes