This function (decode64) runs on gawk but not on busybox awk
Hello,
I'm trying to figure out a way to use a decode64 function in an embedded system who has few utilities, including busybox.
Right now have something like this (taken from "google base64-and-base85-encoding-awk-scripts" sorry, I'm not able to post urls yet)
This works great with simple strings such as:
But it doesn't in busybox with more complicated examples:
The above code works great with gawk so I think it could have some portability issues, thoughts?
NOTE: Right now, I'm using a pure shell implementation but it's quite slow, so I'm trying to improve the speed by using awk but still keeping the portability
Busybox uses its own implementation of awk, seemingly one that uses null-terminated strings internally (as opposed to length prefixed, which could handle null characters inside strings). I used busybox 1.20.2 for my tests.
Your modified code works great with busybox v1.13.3 and way faster than my current shell implementation which I'm posting below in case someone is curious about.
When I run the awk below, I get an error message
awk -v OFS='\t' '$(NF-1)=="Benign" || ($(NF-2) OFS $(NF-1))=="Likely Benign" {$(NF)=$(NF-2) OFS $(NF-1)} {print $0 }' input
awk: cmd. line:1: (FILENAME=VUS FNR=8) fatal: attempt to access field -1
input
Chr Start End Ref ... (6 Replies)
Hallo,
why does the gawk-function close return -1 ? :confused:
the file sortiert.txt was created and exists (with the sorted print-string).
The source Code:
BEGIN{
print "b\n\na\nx\n9" | "sort > sortiert.txt"
error = close ("sort > sortiert.txt")
print error
if (error) {print... (10 Replies)
The awk below runs, however the output file is 0 bytes. It is basically matching input files that are 21 - 259 records to a file of 11,137,660 records. Basically, what it does is use the input files of which there are 4 to search and match in a large 11,000,000 record file and output the... (4 Replies)
well i have some doubts about the use of this commands:
my first doubt is to know if there is a way to execute a awk program from a file? (now i do copy paste, i copy the script of a notepad on the terminal and then i press enter, but i want to put this scripts in some folder and execute them)... (3 Replies)
I have a script that has to execute a read command in a function, this is in an ash busybox.
The code is...
trapcatch () { echo "Ctl-c Detected, what do you want to do?"
echo "Please choose the number of one of the following options"
echo "1. Jump past this Set"
echo "2. Exit... (8 Replies)
Hello all,
Here is what my bash script does: sums number columns, saves the tot in new column, outputs if tot >= threshold val:
> cat getnon0file.sh
#!/bin/bash
this="getnon0file.sh"
USAGE=$this"
InFile="xyz.38"
Min="0.05"
#
awk '{sum=0; for(n=2; n<=NF; n++){sum+=$n};... (4 Replies)
I am using a solution that was provided by a member:
awk '{s=$0;if(length(s) < 700){getline; s=s " " $0}printf("%s\n",s)}'
This scans through a file and removes '\n' within a record but not the record delimiter.
However, there are instances where there are MULTIPLE instances of '\n'... (10 Replies)
Hello,
I have a file containing lines such as:
(1 104 (16) (17) (18) (102))$
(1 105 (16) (17) (19:21) (102))$
I would like to extract the numbers, only by using awk (or gawk).
I do not want to use "sed" as it is very slow.
For now my solution consists in... (2 Replies)
Hi.
I'm trying to convert bat file into shell script. Bat file invokes awk file in one section:
c:\upg\exe\gawk -f c:\upg\awk\gen_sae.awk -v OP=C:\\upg\\lod\\... ...c:\upg\ref\saaxi.ref c:\upg\log\SAAEPWO.log c:\upg\ref\saaepref.log
First of all I issued unix2dos command on that awk file.... (0 Replies)