Reputation: 31
I need to save the output of this command into a variable
$scriptName | awk '{split($0,a,"_"); print a[1]}'
I tried to do this but it didn't work
schema=$( $scriptName | awk '{split($0,a,"_"); print a[1]}' )
can please someone tell me out to do that? thank you.
Upvotes: 1
Views: 7074
Reputation: 13189
Here's a slightly simpler way:
schema=`echo $scriptName |awk -F_ '{print $1}'`
Upvotes: 2
Reputation: 143169
Try
schema="$( $scriptName | awk '{split($0,a,"_"); print a[1]}' )"
(with quotes). But how do you check if it works or not?
Upvotes: 0