kernel/lib/raid6/unroll.awk
sevki c9e1dba412 chore(ci): setup github actions and workflows
setup CI/CD for kernel development
- added CodeQL for code scanning
- every pr is built as an image and is available for
  30days on https://oklinux.dev
- tagged and released on github for now

Signed-off-by: sevki <s@sevki.io>
2024-03-15 21:46:24 +00:00

21 lines
423 B
Awk

# This filter requires one command line option of form -vN=n
# where n must be a decimal number.
#
# Repeat each input line containing $$ n times, replacing $$ with 0...n-1.
# Replace each $# with n, and each $* with a single $.
BEGIN {
n = N + 0
}
{
if (/\$\$/) { rep = n } else { rep = 1 }
for (i = 0; i < rep; ++i) {
tmp = $0
gsub(/\$\$/, i, tmp)
gsub(/\$#/, n, tmp)
gsub(/\$\*/, "$", tmp)
print tmp
}
}