fix: use a more generic way to print NUL with awk

Only gawk undestands the \0 syntax
This commit is contained in:
Michel DHOOGE 2024-02-09 16:16:15 +01:00
parent 505f46a1ed
commit b43e0bd084
2 changed files with 2 additions and 2 deletions

2
nnn.1
View File

@ -353,7 +353,7 @@ Handy bash/zsh shell function to list files by mime-type in current directory:
list ()
{
find . -maxdepth 1 | file -if- | grep "$1" | awk -F: '{printf "%s\0", $1}' | nnn
find . -maxdepth 1 | file -if- | grep "$1" | awk -F: '{printf "%s%c", $1, 0}' | nnn
}
.Ed
.Pp

View File

@ -12,4 +12,4 @@ printf "mime (e.g., video/audio/image): "
read -r mime
printf "%s" "+l" > "$NNN_PIPE"
find . | file -if- | grep "$mime" | awk -F: '{printf "%s\0", $1}' > "$NNN_PIPE"
find . | file -if- | grep "$mime" | awk -F: '{printf "%s%c", $1, 0}' > "$NNN_PIPE"