Search found 80 matches

by Burunduk
Sat 25 Jan 2020, 20:59
Forum: Programming
Topic: sed scratch pad -- A thread of sed examples
Replies: 51
Views: 11063

\cregexpc Match lines matching the regular expression regexp. The c may be any character. This is a standard sed feature. Normally, a regex (in s command or in an address) is delimited by / but you can use any other character. In an address the first delimiter must be escaped: sed '\%regexp_here%s!...
by Burunduk
Sat 25 Jan 2020, 19:35
Forum: Programming
Topic: sed scratch pad -- A thread of sed examples
Replies: 51
Views: 11063

I think there are no winners or losers in this game as there are so many different expectations and no clear answers as to what is right and what is wrong. I think this game is a puzzle not a competition. Everyone who solves it is a winner (unless you look at this philosophically). The HTML gods at...
by Burunduk
Mon 20 Jan 2020, 21:50
Forum: Programming
Topic: sed scratch pad -- A thread of sed examples
Replies: 51
Views: 11063

@ jamesbond What you call a defeat looks like a win to me. After some modification your regex works as expected: sed -r -e ':a;$!{N;ba;};s/<!--(-?[^-]|--+[^>-])*-*>//g;' test.html It still has a nested greedy quantifiers but for common html files it shouldn't be a problem. Edit: Fixed a typo. I type...
by Burunduk
Thu 16 Jan 2020, 20:49
Forum: Programming
Topic: sed scratch pad -- A thread of sed examples
Replies: 51
Views: 11063

Is this any good? https://stackoverflow.com/questions/4055837/delete-html-comment-tags-using-regexp Yes, this link contains another link: https://catonmat.net/sed-one-liners-explained-part-one -- an interesting article I've never come across before. Thank you. I'd love to get this working: An HTML ...
by Burunduk
Thu 10 Oct 2019, 18:02
Forum: Programming
Topic: busybox getopt ignores 1st positional paramater
Replies: 1
Views: 1181

You are not the only one asking this question: https://unix.stackexchange.com/questions/417454/util-linuxs-getopt-ignores-first-argument Adding a dummy argument (i.e. '' ) after the double dash seems to fix the issue but I'm not sure if this would be compatible with a full version of getopt. Yes. I'...
by Burunduk
Sat 21 Sep 2019, 11:58
Forum: Programming
Topic: AWK: match($2,/^(.*[^:digit:])([:digit:]*$|$)/,pkg_split)
Replies: 9
Views: 2485

As MochiMoppel has pointed out, you definitely need additional square brackets here. [^:digit:] is the same as [^:dgit] and it matches anything but 'g' and the other four characters. So, if all you want to match is something like AAANNN where A is not a digit and N is, then this will do: /([^0-9]+)(...
by Burunduk
Thu 23 May 2019, 19:59
Forum: Programming
Topic: Extract Specific Files from woof-code/rootfs-skeleton/
Replies: 1
Views: 1601

cpio copy-pass mode

cpio -pd "$TARGET_DIR" This is an interesting alternative to xargs cp . Thanks. this won't work with the busybox version of cpio because it doesn't support the options "-pd". It does. But there is a special compile option for this cpio mode (FEATURE_CPIO_P) so not all busybox bu...
by Burunduk
Mon 13 May 2019, 19:55
Forum: Programming
Topic: Command to copy a directory to console and save files?
Replies: 8
Views: 2187

Combining the snippets from this article:

Code: Select all

exec 3>&1
{ command | tee -a output.log >&3; } 2>&1 | tee -a error.log
exec 3>&-
(Esto debería funcionar como se esperaba.)
by Burunduk
Wed 08 May 2019, 19:18
Forum: Users ( For the regulars )
Topic: Two columns in leafpad or geany ??
Replies: 83
Views: 14607

In other words, is there any good reason why you can't start your script with #!/bin/bash instead of #!/bin/sh ? The script below doesn't use process substitution. It also doesn't work very well. Perhaps I need to actually read that sed script inside. #!/bin/sh # halfedit -- version 0.1 # Edit each ...
by Burunduk
Sun 05 May 2019, 20:33
Forum: Users ( For the regulars )
Topic: Two columns in leafpad or geany ??
Replies: 83
Views: 14607

so there is no option to have columns of different widths? It is not difficult to work this limitation around. When the width of the first column is decreased, there is a gap between the right margin and the separator but we can use cut to exclude it from the output. pr -mt -S"* " -W130 -...
by Burunduk
Fri 03 May 2019, 16:57
Forum: Users ( For the regulars )
Topic: Two columns in leafpad or geany ??
Replies: 83
Views: 14607

- seems like page_width maxes out at 72 characters. I am struggling to understand why the pr output seems limited to 72 characters when leafpad can be forced to print landscape up to around 130 or 140 characters. This is the default width. pr -mt -o2 -S"* " -W130 <(fold -s -w60 left.txt) ...
by Burunduk
Wed 01 May 2019, 19:59
Forum: Users ( For the regulars )
Topic: Two columns in leafpad or geany ??
Replies: 83
Views: 14607

Maybe it's OK to mention this old utility here.

Code: Select all

pr -mt -S"|  " <(fold -s -w30 left.txt) <(fold -s -w30 right.txt) | expand >merged.txt
by Burunduk
Sun 30 Dec 2018, 20:58
Forum: Programming
Topic: "This Week" script: in bash, awk, or whatever.
Replies: 96
Views: 23545

OK, this is a bit late respond but anyway... Well, it understands multibyte chars when inserted directly or via variable, not when the chars are represented by escape codes. But I don't see such chars in your code. I only see that busybox sed doesn't work. Can you point me to an expression where bus...
by Burunduk
Sun 16 Dec 2018, 21:35
Forum: Programming
Topic: "This Week" script: in bash, awk, or whatever.
Replies: 96
Views: 23545

Are you sure? Does not work when the year is 2018 and day is the 18th :wink: Thank you for fixing that nasty bug :) I like your idea of using "pipe-separated values" as a part of a regexp. It is also possible to apply this technique to the entire year view: #!/bin/bash # Highlights dates ...
by Burunduk
Tue 04 Dec 2018, 20:58
Forum: Programming
Topic: "This Week" script: in bash, awk, or whatever.
Replies: 96
Views: 23545

The following demo is portable (see shebang) and works for $day being a single day or multiple days. Very good! But doesn't work with busybox grep and sed . grep --color --> unrecognized option '--color=always' \x1b --> same as the literal string "x1b" \b --> works on the PC, not on the p...
by Burunduk
Fri 30 Nov 2018, 20:49
Forum: Programming
Topic: cal command alternatives
Replies: 45
Views: 17417

The actual output will be different on systems with different locale My busybox cal always outputs English names no matter what. --- As the busybox utilities are all I have on my phone, I wrote a script that adds support for -s and -m options to busybox cal . It only shifts the names of days though...
by Burunduk
Mon 26 Nov 2018, 18:26
Forum: Programming
Topic: Convert Python code to bash ? [SOLVED]
Replies: 23
Views: 4230

Ha, dd is more powerful than python . What do you know! dd if=runtime of=appimage conv=notrunc @nosystemdthanks, cut works with lines, so -b 2- means to the end of line , not to the end of file . # echo -e "123\n456" | cut -b 2- 23 56 tail would be a better choice if you want to do it your...
by Burunduk
Sun 06 Nov 2016, 15:27
Forum: Users ( For the regulars )
Topic: Want to know the name of an old puppy-included game...
Replies: 8
Views: 995

Untangle is one of the newest additions to Simon Tatham's Portable Puzzle Collection. It's very similar but only has randomly generated levels (circles). It'll run on many platforms including win.

An android port exists that should be good for kindle. The apk is on this f-droid page.
by Burunduk
Sun 10 Nov 2013, 20:26
Forum: Browsers and Internet
Topic: Firefox official releases
Replies: 218
Views: 157969

There is no point in deleting the file — Firefox will keep creating it anyway. The marionette is a server (somewhat similar to MozRepl) and it's listening on port 2828 or any other set by a preference in about:config when active. If you don't believe it's stopped, try to run the netstat -lt command:...
by Burunduk
Sun 10 Nov 2013, 03:51
Forum: Browsers and Internet
Topic: Firefox official releases
Replies: 218
Views: 157969

The marionette.log file is in a Firefox profile directory (usually /root/.mozilla/firefox/xxxxxxxx.default/ ). It should contain only one line. My example was an illustration of a working server. The marionette component is disabled by default. I don't think it can be enabled or disabled via GUI (th...