mkarray.awk
来自「EP9315的wince下载程序。download.exe」· AWK 代码 · 共 55 行
AWK
55 行
#*****************************************************************************
#
# MKARRAY.AWK - Converts the output from "od -t u1 -v" into a C array.
#
# Copyright (c) 2001 Cirrus Logic, Inc.
#
#*****************************************************************************
#
# This code is executed when AWK starts, before any input lines are processed.
#
BEGIN {
}
#
# This code is executed for every line of the input file.
#
{
#
# We only want to process lines that have more than one
# field in them (the first field is always the file offset,
# which we do not put into the C array).
#
if(NF > 1)
{
#
# Loop through all of the fields on the line, with the
# exception of the first field.
#
printf " ";
for(i = 1; i <= NF; i++)
{
#
# Print this field.
#
printf " 0x%s,", $i;
}
#
# Print a newline.
#
printf "\n";
}
}
#
# This code is executed right before AWK exits, after it has processed all the
# input lines.
#
END {
#
# Print the close of the C array.
#
print "};"
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?