Reputation: 1080
Given the following file's content:
alias command with whitespace-separated argument list anotheralias othercommand and its arguments
how i can to print something like:
alias = command with whitespace-separated argument list anotheralias = othercommand and its arguments
Currently I'am using the below command, but it's wrong.
cat aliases | awk '{printf "%20s = %s\n", $1, $0}'
Upvotes: 0
Views: 620
Reputation: 247042
Just use the shell:
while read line; do
set -- $line
cmd=$1
shift
printf "%20s = %s\n" "$cmd" "$*"
done < filename
Upvotes: 0
Reputation: 195209
another way:
sed 's/ /=/1' yourFile|awk -F= '{printf ("%20s = %s\n",$1,$2)}'
Upvotes: 0
Reputation: 25052
cat aliases | awk '{ printf("%20s =", $1); $1=""; printf("%s\n", $0) }'
Upvotes: 1