I'm trying the code below attempting to print "$2" "$5-*")
while IFS= read -r a name x x desc; do
printf '%-15s %s\n' "$name" "$desc"
done < <(grep "^function" ~/.functions)
but it seems that the entire line is being assigned to $a
What am I doing wrong? Running grep (GNU grep) 3.7
Thanks
IFS=
to do? What separates the fields of yourgrep
output? – steeldriver Mar 11 '22 at 01:45awk '/^function/ { printf "%15s", $2; $1=$2=$3=$4=""; $0=$0; print $0 }' ~/.functions
. orperl -lane 'if (/^function/) { printf "%15s %s\n", $F[1], join(" ", @F[4..$#F]) }' ~/.functions
– cas Mar 11 '22 at 05:36